@@ -5711,8 +5711,8 @@ function jsPDF(options) {
57115711 this . x = pageX ;
57125712 this . y = pageY ;
57135713 this . matrix = pageMatrix ;
5714- this . width = getPageWidth ( currentPage ) ;
5715- this . height = getPageHeight ( currentPage ) ;
5714+ this . width = getUnscaledPageWidth ( currentPage ) ;
5715+ this . height = getUnscaledPageHeight ( currentPage ) ;
57165716 this . outputDestination = outputDestination ;
57175717
57185718 this . id = "" ; // set by endFormObject()
@@ -5727,8 +5727,8 @@ function jsPDF(options) {
57275727 pageX = this . x ;
57285728 pageY = this . y ;
57295729 pageMatrix = this . matrix ;
5730- setPageWidth ( currentPage , this . width ) ;
5731- setPageHeight ( currentPage , this . height ) ;
5730+ setPageWidthWithoutScaling ( currentPage , this . width ) ;
5731+ setPageHeightWithoutScaling ( currentPage , this . height ) ;
57325732 outputDestination = this . outputDestination ;
57335733 } ;
57345734
@@ -5953,32 +5953,46 @@ function jsPDF(options) {
59535953 }
59545954 }
59555955
5956- var getPageWidth = ( API . getPageWidth = function ( pageNumber ) {
5957- pageNumber = pageNumber || currentPage ;
5956+ function getUnscaledPageWidth ( pageNumber ) {
5957+ return (
5958+ pagesContext [ pageNumber ] . mediaBox . topRightX -
5959+ pagesContext [ pageNumber ] . mediaBox . bottomLeftX
5960+ ) ;
5961+ }
5962+
5963+ function setPageWidthWithoutScaling ( pageNumber , value ) {
5964+ pagesContext [ pageNumber ] . mediaBox . topRightX =
5965+ value + pagesContext [ pageNumber ] . mediaBox . bottomLeftX ;
5966+ }
5967+
5968+ function getUnscaledPageHeight ( pageNumber ) {
59585969 return (
5959- ( pagesContext [ pageNumber ] . mediaBox . topRightX -
5960- pagesContext [ pageNumber ] . mediaBox . bottomLeftX ) /
5961- scaleFactor
5970+ pagesContext [ pageNumber ] . mediaBox . topRightY -
5971+ pagesContext [ pageNumber ] . mediaBox . bottomLeftY
59625972 ) ;
5973+ }
5974+
5975+ function setPageHeightWithoutScaling ( pageNumber , value ) {
5976+ pagesContext [ pageNumber ] . mediaBox . topRightY =
5977+ value + pagesContext [ pageNumber ] . mediaBox . bottomLeftY ;
5978+ }
5979+
5980+ var getPageWidth = ( API . getPageWidth = function ( pageNumber ) {
5981+ pageNumber = pageNumber || currentPage ;
5982+ return getUnscaledPageWidth ( pageNumber ) / scaleFactor ;
59635983 } ) ;
59645984
59655985 var setPageWidth = ( API . setPageWidth = function ( pageNumber , value ) {
5966- pagesContext [ pageNumber ] . mediaBox . topRightX =
5967- value * scaleFactor + pagesContext [ pageNumber ] . mediaBox . bottomLeftX ;
5986+ setPageWidthWithoutScaling ( pageNumber , value * scaleFactor ) ;
59685987 } ) ;
59695988
59705989 var getPageHeight = ( API . getPageHeight = function ( pageNumber ) {
59715990 pageNumber = pageNumber || currentPage ;
5972- return (
5973- ( pagesContext [ pageNumber ] . mediaBox . topRightY -
5974- pagesContext [ pageNumber ] . mediaBox . bottomLeftY ) /
5975- scaleFactor
5976- ) ;
5991+ return getUnscaledPageHeight ( pageNumber ) / scaleFactor ;
59775992 } ) ;
59785993
59795994 var setPageHeight = ( API . setPageHeight = function ( pageNumber , value ) {
5980- pagesContext [ pageNumber ] . mediaBox . topRightY =
5981- value * scaleFactor + pagesContext [ pageNumber ] . mediaBox . bottomLeftY ;
5995+ setPageHeightWithoutScaling ( pageNumber , value * scaleFactor ) ;
59825996 } ) ;
59835997
59845998 /**
0 commit comments