To create a PDF with a mix of portrait and landscape pages in Pega using HTMLtoPDF, you can follow these steps:
Create the HTML content for your PDF. You can use Pega's HTML Editor or a custom HTML section to do this. Make sure to include the necessary CSS styles for portrait and landscape orientations.
Use a Pega activity to generate the PDF file using the HTMLtoPDF functionality. You can do this by using the "HTMLtoPDF" method from the "Code-Pega-PDF" class.
Before calling the "HTMLtoPDF" method, you can set the orientation of the first and last pages to portrait by setting the "PDFSetPageLayout" parameter to "portrait" in the "Param.PageLayout" parameter page.
To set the orientation of all pages between the first and last pages to landscape, you can add a custom header or footer to your HTML content that contains a page-break element and sets the orientation to "landscape" using CSS.
Once the PDF is generated, you can save it to the desired location using Pega's "File" methods.