PDF-lib icon

PDF-lib

Work with PDFs using pdf-lib

Create PDF

AI-generated

Summary

Create a new PDF document with a specified page size and add multiple text fields with customizable position, font size, and color.

Inputs

  • Page Size (required) — Selects the size of the PDF page: A4, Letter, or Custom dimensions.
  • Width — If Page Size is Custom, sets the page width in points.
  • Height — If Page Size is Custom, sets the page height in points.
  • Text Fields — A collection of one or more text entries to add to the PDF, each specifying text content, X and Y coordinates (origin at bottom-left), font size, and text color in hex format.
  • Output Property Name — The name of the binary property in which to store the generated PDF file. Defaults to 'data'.

Output shape

a single binary file

The output is a single newly created PDF document stored as binary under the specified output property name. The PDF includes a single page with the configured size and the provided text fields rendered at the specified positions with given font sizes and colors.

Examples

Example 1: Create an A4 PDF with two text fields

Page Size set to A4; two text fields added with different positions, font sizes, and colors; output stored in 'data' binary property.

Discussion