How to Create a PDF with Different Page Sizes and Layouts in NetSuite

In NetSuite’s Advanced PDF/HTML templates, it is possible to generate a single PDF that contains pages with varying sizes and layouts. This can be achieved using either the <pbr> tag or the <pdfset> tag.

1. Using the <pbr> Tag

The <pbr> (page break) tag allows you to break the page and specify different size or layout settings for the pages that follow.

You can use conditional logic to insert the <pbr> tag, and define the desired page size or orientation within it. Pages that come after the break will adopt the specified layout.

Example:

2. Using the <pdfset> Tag

The <pdfset> tag enables you to define multiple <pdf> blocks within a single template. Each <pdf> block can have its own page size and layout, allowing complete flexibility over the format of each section.

Example:

<pdfset>

 <pdf>
  <header>...</header>
  <body size="A4-landscape">
   <!-- Content for landscape layout -->
  </body>
 </pdf>

 <pdf>
  <header>...</header>
  <body size="A4-portrait">
   <!-- Content for portrait layout -->
  </body>
 </pdf>

</pdfset>

This approach is ideal when you want to generate a combined document with distinct page configurations for different sections

Leave a comment

Your email address will not be published. Required fields are marked *