Adding Files to Advanced PDF Templates
In NetSuite, you can include files in Advanced PDF/HTML templates in two different ways:
You can use this approach for supporting documents such as spreadsheets, terms and conditions, contracts, or other files that need to be delivered with a transaction PDF. You can also add XML files that contain structured, machine-readable data, so your customers can use accounting software of their choice to extract and process invoice details efficiently.
Add a file as a PDF attachment
To add an attachment to your advanced template:
-
Add a file to the File Cabinet.
-
Go to Documents > Files > File Cabinet and open the folder where you want to upload the file.
-
In the top-left corner, click Add File and select the file you want to upload.
-
Click Open to upload the file.
-
Click Edit next to the uploaded file.
-
Check the Available Without Login setting to ensure the file is accessible.
-
Copy the URL of the file.
-
Click Save to save the changes.
-
-
Edit your advanced PDF template.
In this example, an XML file is added to your template.
-
Go to Customization > Forms > Advanced PDF/HTML Template.
-
Click Customize or Edit next to the template you want to update.
-
In the top-right corner, switch to Source Code mode.
-
Add the following line of code in the template head section.
<link type="attachment/data" name="example.xml" subtype="application/xml" src="https://system.netsuite.com/core/media/media.nl?id=2.xml"/> -
Make the following updates:
-
Replace the value of
srcwith the URL you copied in Step 1f. -
Replace
subtypewith the appropriate file type. -
Replace any
&characters in the link with&. -
Update the
namevalue with the name of your file (for example, data.xls).
-
-
Instead of using a link from the File Cabinet, you can also add a reference to a field that contains the path to your file, for example:
<link type="attachment/data" name="data2_document_field.xml" subtype="application/xml" src="${record.custbody4@url}"/>
Append another PDF to the generated PDF
You can also add an existing PDF file as additional pages in the generated transaction PDF. This is useful when you need to append terms and conditions or a contract to an invoice, sales order, or purchase order. This method appends the PDF to the output; it does not add the file as an attachment.
To append a PDF file to an existing transaction PDF:
-
Go to Customization > Forms > Advanced PDF/HTML Templates.
-
Click Customize or Edit next to the template.
-
In the top-right corner, switch to Source Code mode.
-
Wrap the transaction template and the additional PDF file in a parent
<pdfset>element. -
Use one
<pdf>tag for the transaction content and a separate<pdf>tag with asrcattribute for the PDF file you want to append. After the first PDF, add the following code:<pdf src="${record.custbody_pdf_file@url}"><pdfset> <pdf> <!-- Existing transaction template content goes here --> </pdf> <pdf src="${record.custbody_pdf_file@url}"/> </pdfset> -
Replace the value of
custbody_pdf_filewith the field ID that contains the path to your file. -
Click Save.
Related Topics
- Source Code Editing in the Template Editor
- Source Code Editing to Customize Advanced Templates
- Syntax for Advanced Template Fields
- Setting a Template to Use a Font Unavailable in NetSuite
- Languages for Printed Forms that Use Advanced Templates
- Adding Translated Content in Advanced Printouts
- Adding Striping to Line Items in Advanced Templates
- Adding Page Breaks to Tables
- Printing Subsidiary Logo on Advanced Templates
- Adding Apply Sublist to Check Templates
- Using FreeMarker to Work with Hidden Fields Used in Advanced Templates
- Adding Bar Codes in Advanced Templates
- XML Formatting in Advanced PDF/HTML Templates