printAndSaveRecord

To save a given record in a given layout as PDF in the internal file system and return a link to the file

This function prints a record in a PDF and saves the PDF in the internal file system of Ninox.

You will get a link for either internal access to the file or save it in a record with the importFile() function.

The function can be executed only on the client. Learn more about execution context

Carbone templates

This function works also for Carbone templates and allows you to add optionally a JSON to overwrite the record data for the template.

Syntax

printAndSaveRecord(nid, string)

printAndSaveRecord(nid, string, JSON)

Return

link

Examples

printAndSaveRecord(record, myLayout) To save a given record in a given layout or Carbone template as PDF in the internal file system and return a link to the file.

printAndSaveRecord(this, "Invoices")

Result: https://dbde0000.ninox.com/AbCD1234/12345xYZzyX/loadfile/Invoices.pdf?

You will get a link to the PDF.

printAndSaveRecord(record, myLayout, data) To save a given record in a given Carbone template as PDF in the internal file system and return a link to the file. Record data can be overwritten with a JSON object.

printRecord(this, "Invoices", {
Date: format(if Date = null then Date else today(), "MM/DD/YYYY")
})

Result: https://dbde0000.ninox.com/AbCD1234/12345xYZzyX/loadfile/Invoices.pdf?

You will get a link to the PDF. If there is no entry in the Date field, the date of today will be added, for example, 08/28/2022 on August 28, 2022.

See also

importFile, which imports a file from a URL and saves it as an attachment of a record.

printRecord, which prints to a PDF from a given record in a given layout and opens the file with a program set as default.

Do you want to dive deeper into the topic? Take a look at the corresponding part of our video tutorial.

Last updated