Parse Email Attachments and Split PDFs into Individual Pages Using Make
This tutorial shows how to receive PDF attachments through a Make mailhook, split every PDF into individual pages with PDF.co, and save the resulting files to cloud storage.
Workflow
The completed scenario contains:
- Webhooks — Custom Mailhook
- Flow Control — Iterator
- PDF.co — Split a PDF
- Flow Control — Iterator
- HTTP — Get a File
- Google Drive or Dropbox — Upload a File
Step 1: Create a Custom Mailhook
Add Webhooks as the first module and select Custom Mailhook.
Create a mailhook and copy the generated email address. Send or forward an email containing a PDF attachment to this address, then run the scenario once so Make can detect the email structure.
Step 2: Process Each Attachment
Add Flow Control — Iterator after the mailhook.
In the Array field, map the mailhook’s Attachments[] array. The Iterator will send each attachment through the remaining workflow separately.
If emails may contain other attachment types, add a filter that only continues when the attachment’s filename ends in .pdf or its content type is application/pdf.
Step 3: Split the PDF
Add PDF.co — Split a PDF and connect your PDF.co account.
Configure the module:
- Import Options: Upload a File
- Data: Map the attachment data from the first Iterator
- Output File Name: Map the attachment filename or enter a custom name
- Split By: Page Numbers
- Pages:
* - Export Type: JSON Output
The asterisk instructs PDF.co to create a separate PDF for every page. Other supported page selections and split methods are described in the PDF.co Split a PDF documentation.
Step 4: Process the Split Files
The PDF.co module returns the generated file links in the URLs array.
Add another Flow Control — Iterator and map the PDF.co URLs array into its Array field. This causes the remaining modules to run once for each split PDF.
Step 5: Download Each PDF
Add HTTP — Get a File after the second Iterator.
Map the current URL from the Iterator into the HTTP module’s URL field. This downloads the split PDF so it can be uploaded to permanent storage.
Step 6: Upload the Files
Add Google Drive — Upload a File, Dropbox — Upload a File, or another storage module.
Select the destination folder and map the file data returned by the HTTP module. Give each file a unique name using the original attachment name and the Iterator’s bundle order, for example:
invoice-page-1.pdf
Step 7: Test and Activate the Scenario
Run the scenario and send an email containing a multipage PDF to the mailhook address.
Confirm that:
- The mailhook receives the attachment.
- The first Iterator processes the PDF.
- PDF.co creates one PDF per page.
- The second Iterator processes every output URL.
- Each page is uploaded to the selected storage folder.
Activate the scenario when the test succeeds.
Conclusion
The scenario now receives PDF email attachments, processes multiple attachments independently, splits every PDF into individual pages, and saves each generated file to permanent cloud storage.
Related Tutorials
