Actions108
- AI Actions
- Transcribe
- Detect Brand
- Extract Contact Information
- Mood Detection
- Detect Adult Content
- Enitity Detection
- Language Detection
- Too Long To Read
- Check Content Policy
- Detect Faces
- Generate Python Code
- Picture Text Recognition
- Detect Color
- Generate Image
- PDF OCR
- Translation
- Detect Email Type
- Generate Javascript Code
- Picture Object Recognition
- Business Actions
- Calculate Actions
- Code Actions
- Convert Actions
- Crypto Actions
- Date & Time Actions
- Generate Actions
- Image Actions
- Operator Actions
- PDF Actions
- Storage Actions
- Text Actions
- User Actions
Overview
The PDF Draw operation in this node allows users to add custom drawings onto existing PDF documents. It supports drawing either text or images on specified pages of a PDF file. This is useful for scenarios such as annotating PDFs with notes, stamping images or logos, adding signatures, or customizing reports by overlaying additional content.
Practical examples include:
- Adding a watermark text or logo image to certain pages of a PDF report.
- Annotating specific pages with comments or highlights.
- Overlaying a signature image on contract pages.
- Customizing marketing materials by drawing promotional text or images.
Properties
| Name | Meaning |
|---|---|
| Code Variables | Allows defining variables from the code editor to be used dynamically in the drawing operation. Users can specify variable names/IDs and their values. |
| Draw Pdf | Choose whether to draw "Text" or "Image" on the PDF. |
| URL | Public URL of the PDF file to manipulate. |
| Buffer | Base64-encoded buffer of the PDF file to manipulate. |
| Get File as URL | Boolean indicating if the resulting PDF should be returned as a public URL. |
| Filename | Filename for the output PDF file. |
| Rotation of Image/Text | Counter-clockwise rotation angle (in degrees) for the drawn text or image. |
| Anchor of Image | Position on the page relative to which the image will be anchored. Options: Bottom, Bottom Left, Bottom Right, Center, Left, Right, Top, Top Left, Top Right. |
| Align of Image | Part of the image that aligns with the anchor position. Same options as Anchor. |
| X-Offset | Horizontal offset in points relative to the anchor position. |
| Y-Offset | Vertical offset in points relative to the anchor position. |
| Pages | Specifies which pages to draw on. Supports ranges like "1", "3-5", or relative pages like "^3-^1". |
| Text | The text string to draw on the PDF (required if drawing text). |
| Color | Font color for the text as a six-digit hex code (without #). Default is black ("000000"). |
| Size | Font size in points for the text. Default is 32. |
| Font | Font family for the text. Options: Times Roman, Courier, Helvetica. Default is Times Roman. |
| URL of the Image | Public URL of the image to draw (required if drawing an image). |
| Imagebuffer of Image | Base64-encoded buffer of the image to draw. |
| Width of Image | Width in points for the image to be drawn. |
| Height of Image | Height in points for the image to be drawn. |
Output
The node outputs a JSON array where each item corresponds to the result of processing one input item. The main output field json contains the processed PDF data, typically including:
- The modified PDF file either as a base64-encoded buffer or a public URL depending on the
Get File as URLsetting. - Metadata about the operation may also be included.
If binary data is involved (e.g., image buffers or PDF buffers), it is handled internally but not explicitly exposed in the output JSON.
Dependencies
- Requires access to the PDF file either via a public URL or as a base64-encoded buffer.
- If drawing images, the image must be accessible via a public URL or provided as a base64 buffer.
- The node requires an API key credential for the underlying service that performs the PDF manipulations.
- No other external dependencies are indicated.
Troubleshooting
- Invalid PDF Input: Ensure the PDF URL is publicly accessible or the buffer is correctly base64 encoded.
- Image Not Displaying: Verify the image URL is valid and publicly accessible or the image buffer is correctly formatted.
- Page Range Errors: Use correct page range syntax (e.g., "1", "3-5", "^3-^1") and ensure pages exist in the PDF.
- Color Format Issues: Provide font color as a 6-digit hex code without the "#" prefix.
- Rotation Values: Rotation should be numeric degrees; invalid values may cause unexpected results.
- Missing Required Fields: For drawing text, the "Text" property is required; for images, either "URL of the Image" or "Imagebuffer of the Image" must be provided.
Common error messages usually relate to invalid inputs or inaccessible resources and can be resolved by verifying the above points.
Links and References
- n8n Expressions Documentation
- General PDF manipulation concepts: https://en.wikipedia.org/wiki/PDF
- Hex color codes: https://www.w3schools.com/colors/colors_hexadecimal.asp