Note: Make sure the scanned PDF is shared with “Anyone with the link” so PDF.co can access it for processing.
Turn Images into Optimized, Compressed PDFs Automatically
What You'll Have When Done: A setup that automatically detects new image files in a Google Drive folder, converts them to PDF format, compresses the PDFs to reduce file size, and saves them to another folder for easy access and storage.
Prerequisites
Before you begin, make sure you have:
- A PDF.co API Key (Get yours here)
- Google Drive OAuth2 credentials configured in n8n
- An n8n instance (cloud or self-hosted)
- A designated "incoming" folder in Google Drive for new image files
- A destination folder for your optimized PDFs
Quick Start Options
Option A: I Want It Working Now
- Import this workflow template → Download JSON File
- Connect your Google Drive account in n8n
- Add your PDF.co API key
- Set up your folder structure (incoming images → optimized PDFs)
- Configure the watched folder
- Test with sample image files
- Activate and let it run
Option B: I Want to Build It Step-by-Step
Follow the 5-step guide below to create the automation from scratch.
What This Automation Does (Overview)
- Monitors a specific Google Drive folder for new image files (JPG, PNG, TIFF, etc.)
- Converts images to PDF format using PDF.co's Image to PDF API
- Compresses the resulting PDFs to reduce file size while maintaining quality
- Downloads the processed file from PDF.co
- Uploads the optimized PDF to your designated output folder
Step-by-Step Build Guide
Step 1: Monitor for New Image Files
Node: Google Drive Trigger
Settings:
- Trigger On:
Changes Involving a Specific Folder
- Folder from List: Select your "incoming images" or source folder
- Watch For:
File Created
Success Looks Like: The trigger activates immediately when a new image file is added to your watched folder.
Step 2: Convert Image to PDF
Node: PDF.co API → Convert to PDF
Settings:
- Convert Type:
}Image to PDF (JPG, PNG, TIFF)
- URL:
={{ $json.webContentLink }}
- Advanced Options:
- File Name:
={{ $json.originalFilename }}
- File Name:
What This Does: Takes your image file and converts it into a high-quality PDF format.
Success Looks Like: PDF.co processes the image and returns a URL to the converted PDF file. The response includes the processed file URL for the next step.
Note: To learn more about the Image to PDF API, visit PDF.co API Docs.
Step 3: Compress the PDF for Optimization
Node: PDF.co API → Compress PDF
Settings:
- URL:
={{ $json.url }}
(from the previous conversion step) - Advanced Options: Use default compression settings for balanced quality/size
What This Does: Applies intelligent compression to reduce the PDF file size without significantly impacting visual quality. This is especially useful for large image files or when storage space is a concern.
Success Looks Like: PDF.co returns a compressed version of your PDF with a smaller file size, typically reducing files by 30-70% depending on the original image.
Note: To learn more about the PDF Compress API, visit PDF.co API Docs.
Step 4: Download the Optimized PDF
Node: HTTP Request
Settings:
- Method:
GET
- URL:
={{ $json.url }}
(from the compression step)
What This Does: Downloads the final, optimized PDF file from PDF.co's servers so it can be uploaded to your Google Drive destination folder.
Success Looks Like: The compressed PDF file is downloaded and ready for final upload to your organized folder structure.
Step 5: Upload to Destination Folder
Node: Google Drive → Upload file
Settings:
- Operation: Upload
- Input Data Field Name:
data
- Parent Drive from List:
My Drive
- Parent Folder by ID: Select your "Optimized Files" or destination folder
Success Looks Like: The processed, optimized PDF appears in your designated output folder, ready for use or sharing.
Congrats! You’ve created an automated system that converts images into PDFs and compresses them to save space without sacrificing quality.
Built something cool with this workflow? Share it with us @pdfdotco
Related Tutorials



