0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

PDF → Draw Image on PDF

AI-generated

Overview

The "Draw Image on PDF" operation allows users to add an image onto one or more pages of an existing PDF document. This is useful for scenarios such as watermarking PDFs, adding logos, stamps, signatures, or any custom graphics to reports, contracts, or presentations. For example, a user can overlay a company logo at the top-right corner of every page in a contract PDF or stamp a "Confidential" image centered on specific pages.

Properties

Name Meaning
PDF URL Public URL of the PDF file to modify.
PDF Buffer Base64-encoded PDF data. Can be used instead of providing a URL.
Image URL URL of the image to draw onto the PDF.
Image Buffer Base64-encoded image data. Can be used instead of providing an image URL.
Anchor Position The part of the PDF page where the image should be anchored. Options: Bottom Center, Bottom Left, Bottom Right, Center, Center Left, Center Right, Top Center, Top Left, Top Right.
Alignment The part of the image that aligns with the anchor position on the page. Same options as Anchor Position.
X Offset Horizontal offset in points relative to the anchor position (positive values move right).
Y Offset Vertical offset in points relative to the anchor position (positive values move up).
Width Width of the image in points. If only width is provided, height is calculated automatically to maintain aspect ratio.
Height Height of the image in points. If only height is provided, width is calculated automatically to maintain aspect ratio.
Rotation Counter-clockwise rotation of the image in degrees.
Pages Specifies which pages to draw the image on. Supports ranges and relative page numbers, e.g., "1,3-5,^3-^1" where 1 is first page and ^1 is last page.
File Name Desired file name for the resulting PDF after the image has been drawn.
Return as URL Boolean flag indicating whether to return the modified PDF as a downloadable URL instead of raw data.

Output

The node outputs the modified PDF document with the image drawn on the specified pages. The output JSON contains the updated PDF data, either as a Base64-encoded buffer or as a downloadable URL if the "Return as URL" option is enabled.

If binary data output is supported, it represents the full PDF file including the newly drawn image(s).

Dependencies

  • Requires an API key credential for authentication to the external PDF processing service.
  • The node sends a POST request to a remote endpoint responsible for drawing images on PDFs.
  • The user must provide either a public URL or Base64 buffer of the source PDF and similarly for the image.
  • No local PDF processing; relies on the external service.

Troubleshooting

  • Common issues:

    • Providing both URL and buffer for PDF or image may cause conflicts; use only one method per input.
    • Incorrect page range syntax in the "Pages" property can lead to no changes or errors.
    • Large images or PDFs might cause timeouts or memory issues on the external service.
    • Invalid URLs or inaccessible resources will result in fetch failures.
  • Error messages:

    • "Failed to fetch PDF/image": Check that URLs are publicly accessible and correct.
    • "Invalid page range": Verify the format of the pages string.
    • "Authentication failed": Ensure the API key credential is correctly configured.
    • "Image dimensions invalid": Confirm width and height are positive numbers.

Links and References

Discussion