Is there any way to have mixed page sizes/orientations when creating a PDF from HTML?
Our requirements demand that the first page be letter sized in portrait, and the subsequent pages be landscape mode (some with dynamic widths based on the content). For example, given the below html content we need:
- First page portrait letter
- Second page landscape letter
- Third page landscape letter height, with extra wide width
- Fourth page be portrait letter
In the current implementation we get a PDF where all pages are the same width and height (1100px by letter height). I am aware that setting page size can be done programmatically, however our challenge is that the page content is dynamic and a single section may span multiple pages, and may also be a dynamic width.
Sample Report
.page { page-break-after: always; }
.landscape { page: portraitPage }
.portrait { page: landscapePage }
@page portraitPage { size:portrait }
@page landscapePage { size:landscape }
Portrait cont
Landscape content
Extra wide content
Summary