Understanding and Tags in NetSuite Advanced PDF/HTML Templates

1. Overview of <pdf> and <pdfset> Tags

In NetSuite’s Advanced PDF/HTML templates, the <pdf> and <pdfset> tags control PDF formatting and document structuring. These tags are used to define layout, styling, and configuration for the final PDF output, allowing developers to customize document structure dynamically.

2. Purpose and Usage

  • <pdf> Tag:
  • The <pdf> tag is the root element for defining a PDF document.
  • It serves as a container for all child elements like headers, footers, body content, and embedded styles.
  • Any content within the <pdf> tags will be formatted as a single PDF document.
  • <pdfset> Tag:
  • The <pdfset> tag acts as a wrapper for multiple <pdf> documents, allowing each <pdf> to be treated as a separate document within the same file.
  • It is particularly useful when generating multi-document outputs where each <pdf> section needs unique headers, footers, or settings.
  • Within <pdfset>, each <pdf> acts independently, enabling varied layouts or headers across pages in a combined PDF.

3. Common Use Cases

  • Single Document Layout (<pdf>):
  • Invoices, quotes, and purchase orders where a consistent layout, header, and footer are required across all pages of a single document.
  • Example:

<pdf>

  <head>

    <style type=”text/css”>

      .header { font-size: 12pt; text-align: center; }

      .footer { font-size: 10pt; text-align: right; }

    </style>

  </head>

  <body>

    <div class=”header”>Invoice Header</div>

    <!– Document Content –>

    <div class=”footer”>Page Footer</div>

  </body>

</pdf>

Multiple Document Layouts (<pdfset>):

  • Batches of invoices, multi-page statements, or reports where each document within the PDF set has different formatting requirements or individualized headers and footers.
  • Example:

<pdfset>

  <pdf>

    <head>

      <style type=”text/css”>.header { font-size: 14pt; text-align: center; }</style>

    </head>

    <body>

      <div class=”header”>Document 1 Header</div>

      <!– Document 1 Content –>

    </body>

  </pdf>

  <pdf>

    <head>

      <style type=”text/css”>.header { font-size: 12pt; color: blue; }</style>

    </head>

    <body>

      <div class=”header”>Document 2 Header</div>

      <!– Document 2 Content –>

    </body>

  </pdf>

</pdfset>

4. Key Features and Functionalities

  • Dynamic Styling:
  • CSS styles within the <head> tag apply to elements within each <pdf>. With <pdfset>, unique styles can be applied to each document.
  • Enables customizing fonts, colors, margins, and layout styles.
  • Headers and Footers:
  • Headers and footers can be defined at the document level within each <pdf> for custom page sections.
  • Using <pdfset>, each PDF section can have distinct headers and footers, enhancing multi-document layouts.
  • Page Breaks and Pagination:
  • <pdf> manages pagination within the single document, while <pdfset> separates pagination across multiple documents.
  • For multiple independent documents within a batch, <pdfset> resets pagination for each <pdf>.

5. Best Practices for Using <pdf> and <pdfset>

  • Choosing Between <pdf> and <pdfset>:
  • Use <pdf> for single, unified documents where consistent formatting is required.
  • Use <pdfset> when creating multi-document outputs with varying layouts or individual headers and footers.
  • Manage Performance:
  • Using <pdfset> can impact rendering time when many separate <pdf> sections are present. Limit the number of <pdf> elements within a <pdfset> for better performance.
  • Consistent Header/Footer Structure:
  • When using <pdfset>, ensure each <pdf> has well-defined header/footer sections to maintain professional, cohesive document structure across the output file.
  • Testing Output:
  • Since formatting may vary with different PDF renderers, always test the final output in NetSuite to confirm that the layout, styling, and pagination meet expectations.

6. Example Implementation of Multi-Document PDF (Invoices)

<pdfset>

  <pdf>

    <head>

      <style type=”text/css”>

        .header { font-size: 14pt; text-align: center; color: black; }

        .footer { font-size: 10pt; text-align: right; color: gray; }

      </style>

    </head>

    <body>

      <div class=”header”>Invoice #1</div>

      <!– Invoice Content for Document 1 –>

      <div class=”footer”>Page Footer for Document 1</div>

    </body>

  </pdf>

  <pdf>

    <head>

      <style type=”text/css”>

        .header { font-size: 14pt; text-align: center; color: navy; }

        .footer { font-size: 10pt; text-align: right; color: gray; }

      </style>

    </head>

    <body>

      <div class=”header”>Invoice #2</div>

      <!– Invoice Content for Document 2 –>

      <div class=”footer”>Page Footer for Document 2</div>

    </body>

  </pdf>

</pdfset>

Conclusion

Using <pdf> and <pdfset> effectively allows customization of single and multi-document PDFs within NetSuite’s Advanced PDF/HTML templates. For single documents, <pdf> provides a consistent layout, while <pdfset> offers flexibility for batching documents with distinct layouts and styling. Adopting these tags strategically enhances document presentation, improving readability and professionalism in client-facing documents.

Leave a comment

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