Skip to content

PDF Create

Type: pdf-create  ·  Package: PDF Activities v1.0.0  ·  Output: string

Create a new PDF from text. It is a simple way to generate simple documents from the bot: a receipt, a summary, a process record. Returns the path of the created PDF.

Writes the content to a new PDF in output and returns the file path.

Content is written line by line, and one line maps to one line of the PDF:

  • If you pass a text, every line break starts a new line. All three line endings work (\n, \r\n and \r).
  • If you pass a list, each element is a line. If an element contains line breaks, those are split too.

Lines longer than the page width are wrapped at word boundaries so they fit; a single word that does not fit on its own (a long path, a hash) is split by characters. Text never runs off the side of the page.

To force a page break, include a line with \f or {PAGE_BREAK}.

ParameterEditorDescription
outputexpressionPath of the PDF to create.
contentexpressionText content: a text, where every line break starts a new line, or a list of texts (one line each).
ParameterEditorDescription
titleexpressionDocument title (metadata).
fontSizenumberFont size in points. By default 11.
marginnumberPage margin in centimeters. By default 2.0.

Returns a string with the path of the created PDF.

Generate proof of processing:

PDF Create
output = = "C:/comprobantes/" + numero + ".pdf"
title = = "Comprobante " + numero
content = = arr(
"Comprobante de procesamiento",
"Número: " + numero,
"Fecha: " + now().ToString("yyyy-MM-dd HH:mm"),
"Estado: Procesado correctamente"
)

The same document using a text instead of a list — each \n is a line:

PDF Create
output = = "C:/comprobantes/" + numero + ".pdf"
content = = "Comprobante de procesamiento\n" +
"Número: " + numero + "\n" +
"Estado: Procesado correctamente"

A two-page report, with the break written as just another line:

PDF Create
output = "C:/informes/resumen.pdf"
content = = arr(
"Resumen del proceso",
"Registros procesados: " + total.ToString(),
"{PAGE_BREAK}",
"Anexo: detalle de errores"
)