yWorks / jsPDF

JavaScript PDF generation to work with SVG
MIT License
56 stars 23 forks source link

Losing landscape when printing #21

Closed scottctr closed 5 years ago

scottctr commented 5 years ago

My PDFs are mostly working well, but in Adobe Print Preview it shows as Portrait instead of Landscape and it cuts off the right side of my pages. The pages look fine before opening print preview. Am I missing a setting? I just want all of the pages to be 11 x 8.5 inches (i.e. landscape mode of standard US paper).

const jsPdf = new jsPDF('l', 'pt', [pdfPageWidthPx, pdfPageHeightPx], { orientation: 'landscape', unit: 'px', format: [pdfPageWidthPx, pdfPageHeightPx], compress: true });
...snip....
jsPdf.addPage([Defaults.PdfPageWidthPx, Defaults.PdfPageHeightPx], 'landscape');

image

HackbrettXXX commented 5 years ago

As far as I know there is no property in the PDF format that sets the orientation for printing. In my Acrobat reader there is an "Auto portrait/landscape" option which is selected by default and correctly sets the orientation to landscape for me.