Search code examples
netsuitefreemarkerfont-family

Add Serif font to Advanced PDF in NetSuite


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.


Solution

  • 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.