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:

  1. Add a file to the File Cabinet.

    1. Go to Documents > Files > File Cabinet and open the folder where you want to upload the file.

    2. In the top-left corner, click Add File and select the file you want to upload.

    3. Click Open to upload the file.

    4. Click Edit next to the uploaded file.

    5. Check the Available Without Login setting to ensure the file is accessible.

    6. Copy the URL of the file.

    7. Click Save to save the changes.

  2. Edit your advanced PDF template.

    In this example, an XML file is added to your template.

    1. Go to Customization > Forms > Advanced PDF/HTML Template.

    2. Click Customize or Edit next to the template you want to update.

    3. In the top-right corner, switch to Source Code mode.

    4. 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"/> 
      
                          
    5. Make the following updates:

      • Replace the value of src with the URL you copied in Step 1f.

      • Replace subtype with the appropriate file type.

      • Replace any & characters in the link with &amp;.

      • Update the name value with the name of your file (for example, data.xls).

Tip:

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:

  1. Go to Customization > Forms > Advanced PDF/HTML Templates.

  2. Click Customize or Edit next to the template.

  3. In the top-right corner, switch to Source Code mode.

  4. Wrap the transaction template and the additional PDF file in a parent <pdfset> element.

  5. Use one <pdf> tag for the transaction content and a separate <pdf> tag with a src attribute 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> 
    
                    
  6. Replace the value of custbody_pdf_file with the field ID that contains the path to your file.

  7. Click Save.

Related Topics

General Notices