Automatic PDF Compression and Storage for Google Drive - n8n Workflow

Automate PDF compression directly from Google Drive using iLovePDF. This robust n8n workflow watches a folder, compresses files, and archives the results using multiple n8n nodes.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users needing to manage large volumes of PDF documents and optimize cloud storage.

  • Automation specialists looking for advanced examples of integrating n8n with file processing APIs.

  • Businesses that frequently archive documents and require mandatory compression.

  • Developers seeking ready-made n8n templates for cloud storage and external API interactions.

Overview

This powerful n8n workflow provides a solution for storage optimization by automatically handling large PDF files uploaded to Google Drive. The moment a new PDF appears in your designated source folder, this n8n automation takes over. It downloads the file, processes it through the iLovePDF API for high-level compression, and then saves the compressed file into a separate output folder. This specific n8n workflow ensures that your storage footprint is minimized without manual intervention. Leveraging the Google Drive n8n trigger and several HTTP Request n8n node types, this is a perfect example of a comprehensive file management system built entirely on n8n.

How it Works

The process begins with the Google Drive n8n trigger, which constantly monitors a specific folder for new file uploads.


  1. Authentication: Upon detection, the n8n workflow first authenticates with the iLoveAPI server by sending the Public Key via an HTTP Request node to obtain a Bearer token.

  2. Task Creation: A subsequent HTTP Request n8n node initiates a 'compress' task on the iLoveAPI server, receiving a unique Task ID and server details.

  3. File Handling: The original file is downloaded from Google Drive using the Google Drive n8n node, and the critical data (Token, Task ID, Server details, and the downloaded file) is combined using the Merge n8n node.

  4. Upload & Process: The file is uploaded to the iLoveAPI server. Another HTTP Request n8n node then executes the compression process.

  5. Download Compressed File: The optimized PDF is downloaded back into the n8n workflow execution context as binary data.

  6. Final Storage: The final Google Drive n8n node saves the newly compressed PDF into a designated destination folder, completing the n8n workflow execution. This end-to-end automation transforms your file management routine.

Installation Guide

To install this n8n workflow using one of our n8n templates, follow these steps:


  1. Import: Copy the provided JSON code and import it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Google Drive Credentials: Set up your Google Drive credentials. Ensure the Google Drive Trigger node is configured to watch the correct source folder and that the final Google Drive node targets the correct destination folder.

  3. iLoveAPI Credentials: You must obtain a Public Key from your iLoveAPI developer account.

  4. Configure API Keys: In the HTTP Request n8n node named 'Send your iLoveAPI public key to their server' and the 'Get task from iLoveAPI server' n8n node, replace YOURILOVEAPIPUBLIC_KEY with your actual key.

  5. Activate: Once all n8n node configurations and credentials are set, activate the n8n workflow. Use the manual trigger for initial testing before deploying the Google Drive n8n trigger.

Node Details


  • Upload your file to Google Drive (Google Drive Trigger): This is the core n8n trigger. It listens for the fileCreated event within a specified Google Drive folder, initiating the entire n8n workflow.

  • Send your iLoveAPI public key to their server (HTTP Request): This n8n node handles the initial authentication, sending the API Public Key to secure a necessary Bearer token for all subsequent iLovePDF API calls.

  • Download file (Google Drive): Downloads the binary data of the newly detected file from the monitored Google Drive folder.

  • Merge (Group public key, task and downloaded file data): A crucial core logic n8n node that combines the authentication token, the task ID (from iLovePDF), and the downloaded file data so they can all be processed in the next steps.

  • Upload PDF to iLoveAPI server (HTTP Request): Uses the combined data and the Bearer token to upload the PDF file to the specific iLovePDF task server.

  • Compress your file (HTTP Request): Executes the compression process command on the uploaded file using the v1/process endpoint.

  • Download compressed file (HTTP Request): Downloads the resulting compressed PDF file. This n8n node is configured to save the output as binary data for subsequent steps.

  • Move compressed file to new Google Drive folder (Google Drive): The final n8n node responsible for saving the compressed file into the designated Google Drive output folder.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
ilovepdf
ilovepdf

Featured*