Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Home/ Advanced PDF Templates in NetSuite/Styling with CSS in Advanced PDF

Styling with CSS in Advanced PDF

NetSuite Advanced PDF templates support HTML and inline CSS for controlling the layout, fonts, colors, and overall look of your transaction documents. Styling with CSS helps you create professional and branded invoices, sales orders, statements, and more.

This page covers the best CSS techniques for Advanced PDF and includes practical examples.


🔹 Why Use CSS in Advanced PDF?

  • Improve readability with consistent fonts and spacing
  • Align amounts, dates, and labels neatly
  • Apply branding colors (headers, footers, highlights)
  • Add borders, shading, and alignment to tables
  • Control page breaks and margins for print-friendly layouts

🔹 Basic Inline Styling

<p style="font-size:14px; font-weight:bold; color:#2E86C1;">
   Invoice #: ${record.tranid}
</p>
<p style="font-size:12px; color:#555;">
   Date: ${record.trandate?string("MMMM dd, yyyy")}
</p>

✔️ Inline styles are recommended because external CSS files are not supported in PDFs.


🔹 Table Styling

<table width="100%" style="border-collapse: collapse; font-size:12px;">
   <tr style="background:#f2f2f2; font-weight:bold;">
      <th style="border:1px solid #ccc; padding:5px;">Item</th>
      <th style="border:1px solid #ccc; padding:5px;">Description</th>
      <th style="border:1px solid #ccc; padding:5px; text-align:center;">Qty</th>
      <th style="border:1px solid #ccc; padding:5px; text-align:right;">Rate</th>
      <th style="border:1px solid #ccc; padding:5px; text-align:right;">Amount</th>
   </tr>
   <#list record.item as i>
      <tr>
         <td style="border:1px solid #ddd; padding:5px;">${i.item}</td>
         <td style="border:1px solid #ddd; padding:5px;">${i.description}</td>
         <td style="border:1px solid #ddd; padding:5px; text-align:center;">${i.quantity}</td>
         <td style="border:1px solid #ddd; padding:5px; text-align:right;">${i.rate?string["#,##0.00"]}</td>
         <td style="border:1px solid #ddd; padding:5px; text-align:right;">${i.amount?string["#,##0.00"]}</td>
      </tr>
   </#list>
</table>

✔️ Borders, padding, and alignment improve readability.


🔹 Alternating Row Colors (Zebra Striping)

<#list record.item as i>
   <tr <#if i_index % 2 == 0>style="background:#f9f9f9;"</#if>>
      <td style="padding:5px;">${i.item}</td>
      <td style="padding:5px;">${i.description}</td>
      <td style="padding:5px; text-align:center;">${i.quantity}</td>
      <td style="padding:5px; text-align:right;">${i.rate?string["#,##0.00"]}</td>
      <td style="padding:5px; text-align:right;">${i.amount?string["#,##0.00"]}</td>
   </tr>
</#list>

✔️ Makes large tables easier to scan.


🔹 Headers & Footers Styling

<div style="text-align:center; font-size:16px; font-weight:bold; color:#2E4053;">
   ${record.companyname}
</div>
<div style="text-align:center; font-size:11px; color:#555;">
   ${record.mainaddress}
</div>
<hr style="border:1px solid #ccc; margin:10px 0;" />

✔️ Adds a professional header with branding.


🔹 Page Breaks

Sometimes you need content to start on a new page.

<div style="page-break-before:always;"></div>

✔️ Forces the next section onto a new page.


🔹 Highlighting Important Fields

<p style="background:#FFEB3B; padding:5px; font-weight:bold;">
   Total Due: ${record.total?string["#,##0.00"]} ${record.currency}
</p>

✔️ Draws attention to amounts due.


✅ Best Practices

  • Always use inline CSS (style="...")
  • Use web-safe fonts: Arial, Times New Roman, Courier New
  • Keep table borders and spacing consistent
  • Avoid very large images (slows down PDF rendering)
  • Test across multiple records and page lengths

✅ Summary — What You Learned

By the end of this page, you know how to:

  • ✅ Apply inline CSS for fonts, colors, and sizes
  • ✅ Style tables with borders, padding, and alignment
  • ✅ Use alternating row colors for readability
  • ✅ Create professional headers and footers
  • ✅ Control page breaks for long PDFs
  • ✅ Highlight important fields with background colors

This sets you up for the next page: Common Errors & Fixes, where you’ll learn how to troubleshoot broken templates, empty fields, and formatting issues.

Share
  • Facebook

Leave a ReplyCancel reply

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuite’s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 21 Points
Begginer
admin

admin

  • 5 Questions
  • 2 Points

Trending Tags

clientscript netsuite scripting suitescript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

© 2025 The NetSuite Pro. All Rights Reserved