Add Serif font to Advanced PDF in NetSuite

181 Views Asked by At

I am wanting to have one specific line in an Advanced PDF to show as serif font (Times New Roman to be specific). I have uploaded the .ttf file to the File Cabinet and have "Available without login" checked. I assign the link to a variable then use that to link the file to the Advanced PDF:

<#assign font_times_regular = "[[link to file in file cabinet]]" />
<link name="times" type="font" subtype="opentype" src="${font_times_regular}"></link>

and then use the <td> itself to define the font

<td align="center" colspan="6" style="padding-top: 10px;padding-bottom:10px; font-family: 'times'; font-size: 11pt;" class="dtName">${ordernum}</td>

but whenever I call the suitelet to print the file the new font does not show up. I've followed the SuiteAnswers article about it to a T. What am I missing? the Class dtName uses the same font in its definition:

.dtName {
        border-top:1px solid black;
        border-right:1px solid black;
        border-left:1px solid black;
        valign:middle;
        font-family: times, serif;
  }

This is the way I've been trying to get it to work but if theres a way to get a serif without needing to import a custom font I would like to know too.

2

There are 2 best solutions below

0
Zachary Belles On BEST ANSWER

Turns out I cannot use Times New Roman to begin with because we do not have a license to use it. However I managed to get the NetSuite built in "NotoSerif" to work. I replaced my <link> tag with one that defines NotoSerif:

<link name="NotoSerif" type="font" subtype="opentype" src="${nsfont.notoserif_regular}" bytes="2"></link>

Then used it in a <span> tag that went inside my <td> tag:

<td align="center" colspan="6" style="padding-top: 10px;padding-bottom:10px;" class="headerinfo">
  <span style="font-family: 'NotoSerif'; font-size: 11pt;">${ordernum}</span>
</td>

After that the line I needed as Serif printed as such.

0
bknights On

Times New Roman is included in most (all?) versions of Windows.

NotoSerif is not included in my version of windows. It may be available internationalized versions since Netsuite includes Noto family fonts in the standard Advanced templates.

To make your template more universal you would specify it more like:

<span style="font-family: 'NotoSerif', 'Times New Roman', serif;"...

If you find an open source or freely licensed font you want to use for consistency across devices Netsuite has a help note under the heading: Setting a Template to Use a Font Unavailable in NetSuite which may be of use.