Skip to main content

Text to PDF

Converts a text file to a PDF document.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • In Text File Path - The path to the text file that will be converted to PDF.

Options

  • Out PDF File Path - The path where the generated PDF file will be saved.
  • Font Size - The font size to use in the PDF document. Default is 10.
  • Font family - The font family to use in the PDF document.

Output

  • result - The result of the text to PDF conversion operation.

How It Works

The Text to PDF node creates a PDF document from the content of a text file. When executed, the node:

  1. Validates that the input text file path is not empty
  2. Checks that a font family is specified
  3. Reads the entire content of the text file
  4. Creates a new PDF document
  5. Sets up the page with appropriate margins
  6. Processes the text content, wrapping lines to fit within page margins
  7. Writes the text to the PDF using the specified font and size
  8. Saves the PDF to the specified output path
  9. Closes all document resources

Requirements

  • A valid text file path
  • An output path where the PDF can be saved
  • A valid font family selection
  • Sufficient permissions to read the input file and write to the output location

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid text file path
  • Text file does not exist
  • Font family is not specified
  • File I/O errors
  • PDF processing errors

Usage Notes

  • The node supports several standard PDF font families including:
    • Courier (and bold, oblique, bold oblique variants)
    • Helvetica (and bold, oblique, bold oblique variants)
    • Times Roman (and bold, italic, bold italic variants)
    • Symbol
    • ZapfDingbats
  • Text is automatically wrapped to fit within page margins
  • Empty lines in the text file are preserved in the PDF
  • The default font size is 10 points
  • The default font is Times-Roman if an invalid font is specified
  • Page margins are set to 72 points (1 inch) on all sides