How To add Custom Fonts to NetSuite Generated PDF Documents

  1. Get the Font File: Obtain a copy of the actual .ttf file(s) for the font(s) you wish to use.
  2. Store the Font File: Upload all versions of the .ttf files (Regular, Bold, Italic, Bold-Italic, etc.) to a designated location in the NetSuite File Cabinet. Be sure the .ttf font file(s) is/are accessible from NetSuite and the switch “Available Without Login” is set to ON. Get the URL that is supplied by the file information.
  3. Reference the Font File: Code up the font linkage in the template file

NetSuite Template File Sample for Additional Font Definition

<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
<head>

<#assign font_notosans_regular = "https://tstdrv1030358.app.netsuite.com/core/media/media.nl?id=64862&c=TSTDRV1030358&h=ffaf3cf738e4a580f9d6&_xt=.ttf" />
<#assign font_notosans_bold = "https://tstdrv1030358.app.netsuite.com/core/media/media.nl?id=64860&c=TSTDRV1030358&h=dafa1f767234034bb616&_xt=.ttf" />
<#assign font_notosans_italic = "https://tstdrv1030358.app.netsuite.com/core/media/media.nl?id=64861&c=TSTDRV1030358&h=e288e0b7f19cdf549bbb&_xt=.ttf" />
<#assign font_notosans_bolditalic = "https://tstdrv1030358.app.netsuite.com/core/media/media.nl?id=64860&c=TSTDRV1030358&h=dafa1f767234034bb616&_xt=.ttf" />

<link type="font" name="NotoSans" subtype="TrueType" src="${font_notosans_regular?html}" src-bold="${font_notosans_bold?html}" src-italic="${font_notosans_italic?html}" src-bolditalic="${font_notosans_bolditalic?html}" />

<style type="text/css">
* {
  font-family: NotoSans, Arial, sans-serif;
}
body {
  font-family: NotoSans, Arial, sans-serif;
  font-size: 18pt;
}
</style>
</head>
<body>
  <table><tr><td>
    <p><b><span style="font-size: 24pt;">Example Font Addition: Noto Sans</span></b></p>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
    <p>123456790</p>
    <p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
    <p>abcdefghijklmnopqrstuvwxyz</p>
    <p><b>ABCDEFGHIJKLMNOPQRSTUVWXYZ</b></p>
    <p><b>abcdefghijklmnopqrstuvwxyz</b></p>
    <p><b><i>ABCDEFGHIJKLMNOPQRSTUVWXYZ</i></b></p>
    <p><b><i>abcdefghijklmnopqrstuvwxyz</i></b></p>
    <p><i>ABCDEFGHIJKLMNOPQRSTUVWXYZ</i></p>
    <p><i>abcdefghijklmnopqrstuvwxyz</i></p>
    <p><i>${font_notosans_regular?html}</i></p>
  </td></tr></table>
</body>
</pdf>

Leave a comment

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