Adobe PDF Compression for Email
When a PDF exceeds the mailbox attachment limit, the flow compresses it with Adobe PDF Services to a target size and either re-attaches the smaller file or, if still too large, sends a SharePoint share link instead. Stops oversized PDFs from bouncing and keeps email deliverable.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
FlowLibs - Adobe PDF Compression for Email automatically shrinks oversized outbound PDFs so they stay under the mailbox attachment limit. When a PDF lands in a watched SharePoint folder, the flow measures it, and if it exceeds the configured limit it compresses the file with Adobe PDF Services (real REST API). It then emails the smaller file as an attachment — or, if the compressed file is *still* too large, archives it to SharePoint and emails a share link instead.
Why it matters: Large attachments bounce off mailbox size caps or clog inboxes. Auto-compression keeps documents deliverable, with a share-link fallback so nothing ever fails to send.
Build note: The Adobe PDF Services *connector* (shared_adobepdftools) cannot be authored through the API/solution build path — its file-upload parameter is not bindable outside the interactive designer. So this flow calls the Adobe PDF Services REST API directly via the built-in HTTP action. Going live requires only the Adobe client credentials in the environment variables.
Use Case
Anyone emailing large PDFs (operations, finance, legal, general staff) wants them automatically reduced to a sendable size — or linked when they are still too big — without manual re-saving or zipping.
Flow Architecture
When a PDF is added to the outbound library
SharePoint — GetOnNewFileItems (poll + splitOn)Fires per new file in the watched library/folder.
Initialize config variables
Initialize Variable (x12)Seed site, library, folders, max MB, compression level, recipient, Adobe base/id/secret, link type/scope, job status.
Check File Is PDF
ConditionOnly process .pdf files (else: do nothing).
Get Original File Content
SharePoint — GetFileContentDownload the source PDF bytes and estimate original size from base64 length.
Check If Oversized
ConditionBranch when original size exceeds the configured limit.
Get Adobe Access Token
HTTP — POST /tokenOAuth server-to-server token from Adobe.
Create Upload Asset + Upload PDF
HTTP — POST /assets + PUT (pre-signed URI)Get a pre-signed upload URI and assetID, then upload raw PDF bytes.
Start Compress Job + Poll Until Complete
HTTP — POST /operation/compresspdf + Until loopStart compression and poll the status location every 5s until done/failed.
Download Compressed PDF + Save to SharePoint
HTTP GET (pre-signed URI) + SharePoint — CreateFileDownload the compressed PDF and archive it for the link fallback.
Check If Still Too Large
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | SharePoint site address (dataset). |
| flowlibs_PdfWatchLibrary | String | Documents | Library watched for new PDFs; also the library for the share link. |
| flowlibs_PdfWatchFolder | String | /Shared Documents/Outbound | Server-relative folder the trigger watches. |
| flowlibs_CompressedFolderPath | String | /Shared Documents/Compressed | Folder where compressed PDFs are saved. |
| flowlibs_MaxAttachmentMB | String | 20 | Size limit (MB) before compression / link fallback. |
| flowlibs_CompressionLevel | String | MEDIUM | Adobe compression strength: LOW / MEDIUM / HIGH. |
| flowlibs_NotificationEmail | String | alerts@yourcompany.com | Recipient of the outbound email. |
| flowlibs_AdobePdfServicesBase | String | https://pdf-services.adobe.io | Adobe PDF Services REST API base URL. |
| flowlibs_AdobeClientId | String | <configure> | Adobe API client ID (Adobe Developer Console). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| HTTP | http | POST /token POST /assets PUT (upload) POST /operation/compresspdf GET (status/download) |
| SharePoint | shared_sharepointonline | GetOnNewFileItems GetFileContent CreateFile CreateSharingLink |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Go live
- Populate flowlibs_AdobeClientId / flowlibs_AdobeClientSecret, authorize the SharePoint + Outlook connections, point flowlibs_PdfWatchFolder at your library, then turn the flow On.
- Different size cap / strength
- Change flowlibs_MaxAttachmentMB (e.g. 10 for stricter mail servers) and flowlibs_CompressionLevel (HIGH = smallest, lowest fidelity).
- Anonymous links
- Change the Initialize Link Scope value to anonymous (if tenant sharing policy allows) and Initialize Link Type to edit for editable links.
- Per-recipient routing
- Drive flowlibs_NotificationEmail from the PDF's metadata or a lookup instead of a fixed address.
- Archive sweep
- Add a Recurrence-triggered sibling flow that compresses every PDF over the cap on a schedule to reclaim storage.
- Keep original
- The source file is left in place; the compressed copy goes to a separate folder, so the high-res original is always retained.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Original size (bytes) from base64
Estimate original byte size from the base64 content length.
EXPR.02Over-limit gate
Trigger compression when the file exceeds the MB limit.
EXPR.03Adobe token body
OAuth server-to-server token request body.
EXPR.04Until exit condition
Stop polling when the Adobe job is done or failed.
EXPR.05Share link URL
Pull the org share-link URL for the fallback email.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.