Actions21
- Document Actions
- PDF Service Actions
- Template Actions
- Workspace Actions
PDF Service → Optimize Document
AI-generatedOverview
This node operation optimizes the size of an existing PDF document to improve performance and reduce file size. It supports input PDFs either from a public URL or as base64 encoded content. The optimized PDF can be returned in various formats including base64 JSON, binary file data, or a download URL. This operation is useful for scenarios where PDF documents need to be compressed or optimized before storage, sharing, or further processing, such as reducing bandwidth usage or improving load times.
Use Case Examples
- Optimizing a PDF document fetched from a public URL to reduce its file size before sending it via email.
- Optimizing a base64 encoded PDF received from another system to store a smaller version in a database.
- Converting an optimized PDF to a binary file for direct download in a web application.
Properties
| Name | Meaning |
|---|---|
| PDF Source | Specifies the source of the PDF document to optimize, either from a public URL or base64 encoded content. |
| PDF URL | The public URL to the PDF document to be optimized. Required if PDF Source is 'From URL'. |
| PDF Base64 | The base64 encoded content of the PDF document to be optimized. Required if PDF Source is 'From Base64'. |
| Output Format | The format in which the optimized PDF should be returned: as a base64 string in JSON, as a binary file for download, or as a URL in JSON. |
Output
Binary
When the output format is set to 'File (Binary)', the node outputs the optimized PDF as binary data suitable for download or attachment.
JSON
success- Indicates if the optimization operation was successfuloperation- The operation performed, here it will be 'optimize'format- The output format chosen for the optimized PDFfilename- The filename of the optimized PDF when output as a filefileSize- The size of the optimized PDF file in bytesoptimizationStatsoriginalSize- The original size of the PDF before optimization, in bytesoptimizedSize- The size of the PDF after optimization, in bytessavedBytes- The number of bytes saved by optimizationcompressionRatio- The percentage reduction in file size due to optimization
Dependencies
- An API key credential for the PDF Generator API service is required to authenticate requests.
Troubleshooting
- Ensure the PDF source is correctly specified and the URL or base64 content is valid and accessible.
- If the operation fails, check that the API key credential is valid and has the necessary permissions.
- For binary output, verify that the downstream nodes or systems can handle binary PDF data.
- Error messages related to invalid JSON input indicate that the base64 content or other JSON parameters must be correctly formatted.