
Optimize PDFs for Email Attachment with PDF Compression
Keep Business PDFs Small Enough for Email Delivery
Invoices, statements, reports, proposals, and claim packages often need to reach customers and partners as email attachments. When a PDF is too large, the delivery workflow breaks at the last mile: the message can be rejected, rerouted as a link, or require someone to intervene manually.
The pdfRest Compress PDF API Tool gives email workflows a direct way to produce smaller, delivery-ready PDFs. Instead of treating oversized attachments as an exception, the application can make compression a built-in part of the send path and keep documents moving toward the recipient.
The applicable threshold may account for the complete message rather than only the PDF, and email transport encoding can increase the transmitted payload beyond the file's size on disk.
Current documented limits for common consumer email services provide a useful planning baseline:
| Service | Current documented limit | Scope |
|---|---|---|
| Gmail | 25 MB | Total attachments in a personal Gmail message; Google Workspace limits can be set by the administrator. |
| Outlook.com | 25 MB | Complete email, including text and attached files. |
| Yahoo Mail | 25 MB | Total attached files in one incoming or outgoing message. |
These published limits are current as of September 2026, but a delivery workflow should still use the policy configured for its actual sending account, mail gateway, and recipient channel. Business Exchange, Google Workspace, and security gateways can impose different limits.
A reliable workflow uses both the current provider baseline and application configuration. The application knows the recipient channel and reserved message overhead, while pdfRest supplies the document information and PDF compression needed to prepare the attachment.
The Query PDF API Tool returns the document's file_size in bytes. The delivery service can compare that result with its configured threshold and call the Compress PDF API Tool when the attachment requires optimization.
Match Compression to the Delivery Requirement
Compress PDF offers low, medium, and high presets. Low favors fidelity, medium balances reduction and fidelity for general use, and high prioritizes a smaller result for size-constrained delivery. Image-heavy PDFs often provide the greatest reduction opportunity because images can carry far more data than text and vector content.
For workflows with specialized document classes, compression_level=custom accepts a JSON profile that controls how images, fonts, user data, and other PDF objects are handled. A billing platform can use one profile for text-focused statements and another for inspection reports containing high-resolution photographs. The same pdfRest capability supports both without building multiple compression services.
pdfRest's current published testing shows average file-size reductions from 53% with low compression to 68% with high compression, with reductions up to 98% for image-heavy PDFs. Actual reduction varies with the source file, but the results show why automated compression is valuable before a document reaches an attachment limit.
Make Attachment Size Part of the Delivery Workflow
Consider an insurance platform that generates a claim report after an adjuster closes a case. The report may contain forms, supporting photographs, and merged correspondence. The platform sends the completed resource ID to Query PDF, compares the returned size with the email route's attachment policy, and applies high compression when required. The result can move directly into the mail service under an email-specific filename.
Resource-ID chaining keeps that path efficient. A report created by Merge PDFs, Convert to PDF, or another pdfRest tool can enter Compress PDF by ID rather than being downloaded and uploaded between steps. The mailer receives the delivery-ready document while the PDF processing remains a reusable backend capability.
This pattern also supports more than one delivery rule. Customer email, internal mail, and partner gateways can each use a different threshold or compression policy without changing the core PDF processing integration. The value is straightforward: documents stay small enough for the route they need to take, and the application handles that decision automatically.
Apply High Compression for an Email Attachment
The following current cURL request applies the high preset and names the result for email delivery.
Apply High PDF Compression for Email Code Example | Load this into API Lab↗
# By default, this request uses the US-based API service. API_URL="https://api.pdfrest.com" # For the EU-based service, use: # API_URL="https://eu-api.pdfrest.com" curl -X POST "$API_URL/compressed-pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ -F "file=@/path/to/claim_report.pdf" \ -F "compression_level=high" \ -F "output=claim_report_email"
Use API Lab to compare compression profiles. The Compress PDF and Query PDF references list the current fields for both operations.
Use API Lab to compare compression profiles. The Compress PDF and Query PDF references list the current fields for both operations.
|
Compress PDF |