pdfmake-wrapper icon indicating copy to clipboard operation
pdfmake-wrapper copied to clipboard

Help Please: How Do You Mix Page Orientations?

Open lartheon opened this issue 3 years ago • 1 comments

Hi, I am converting some html to PDF but I have a couple of issues.

  1. Can't mix page orientations
  2. I can't seem to insert a blank page
//example get html var printContents = document.getElementById("exampleId")?.innerHTML;
//example var html = htmlToPdfmake(printContents);

var htmlBlankPage = htmlToPdfmake(); //not sure what should go here
var htmlOverview = htmlToPdfmake(printOverview);
var htmlFFListing = htmlToPdfmake(printFFListing);
var htmlNNListing = htmlToPdfmake(printNNListing);
var htmlSSListing = htmlToPdfmake(printSSListing);
var htmlSummary = htmlToPdfmake(printSummary);

const pdf = new PdfMakeWrapper();
PdfMakeWrapper.setFonts(pdfFonts);

pdf.pageSize("A4");
pdf.pageOrientation("portrait");
pdf.add(printOverview);
pdf.add(); // add blank page
pdf.add(printFFListing);
pdf.pageOrientation("landscape");
pdf.add(printNNListing); // should be displayed in landscape
pdf.pageOrientation("portrait"); // the rest of the pdf in portrait
pdf.add(printSSListing);
pdf.add(); // add blank page
pdf.add(summary);

Thank you

lartheon avatar Apr 09 '21 13:04 lartheon

any definition (Txt, Ol, etc..) has a method to break a page and orientation. For example:

pdf.add(printOverview);
pdf.add(
  new Txt('some text').pageOrientation('portrait').pageBreak('before').end
);
pdf.add(
  new Txt('some text 2').pageOrientation('landscape').pageBreak('before').end
);

Please close this issues if it was resolved.

Lugriz avatar May 28 '21 04:05 Lugriz