Permalink
Browse files

fixing jsPDF constructor: swapping width / height only when needed

  • Loading branch information...
1 parent ba9495b commit 9021d1c7d5c1661cb73405032bc958e9bd919875 @fjenett committed Oct 7, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 jspdf.js
View
13 jspdf.js
@@ -319,11 +319,18 @@ function jsPDF(/** String */ orientation, /** String */ unit, /** String */ form
if (orientation === 'p' || orientation === 'portrait') {
orientation = 'p'
+ if ( pageWidth > pageHeight ) {
+ var tmp = pageWidth
+ pageWidth = pageHeight
+ pageHeight = tmp
+ }
} else if (orientation === 'l' || orientation === 'landscape') {
orientation = 'l'
- var tmp = pageWidth
- pageWidth = pageHeight
- pageHeight = tmp
+ if ( pageHeight > pageWidth ) {
+ var tmp = pageWidth
+ pageWidth = pageHeight
+ pageHeight = tmp
+ }
} else {
throw('Invalid orientation: ' + orientation)
}

0 comments on commit 9021d1c

Please sign in to comment.