Introduction
Handle rich media PDFs: video, audio, 3D objects, and their impact on file size. This is an advanced guide for experienced users and developers. We'll dive deep into the technical details, edge cases, and professional workflows. Whether you're using PDFly's free online tools or building your own workflow, this guide covers everything you need to know about compressing pdfs with embedded videos and media.
Understanding Compression
PDF compression reduces file size while maintaining acceptable quality. Large PDFs cause slow loading, email rejection, and storage issues. By understanding compression techniques — from image downsampling to font subsetting — you can achieve dramatic size reductions (often 50-90%) without visible quality loss.
Key Concepts You Need to Know
- Image downsampling is the most effective compression technique for image-heavy PDFs
- Font subsetting embeds only used characters, reducing file size significantly
- Lossy compression (DCTDecode for JPEG) offers smaller sizes but reduces quality
- Lossless compression (FlateDecode) preserves quality but achieves smaller reductions
- Object stream compression (PDF 1.5+) compresses the PDF structure itself
Tips & Best Practices
Start with medium compression and increase only if the result is still too large
Scan at 300 DPI — higher resolutions waste space without improving readability
Convert color scans to grayscale when color isn't needed for 60-70% size reduction
Remove unnecessary metadata and embedded fonts for additional savings
Test compressed files on different devices to verify quality
Common Mistakes to Avoid
- Over-compressing images creates artifacts and reduces readability
- Compressing already-compressed PDFs yields minimal additional savings
- Removing metadata may lose important document information
- Font subsetting can cause issues if text needs to be edited later
- Different compression settings are needed for web vs print PDFs
Comparing Your Options
| Feature | Option A | Option B |
|---|---|---|
| Quality | Lossless (FlateDecode) | Lossy (DCTDecode/JPEG) |
| File Size | Moderate reduction | Large reduction |
| Best For | Text documents | Image-heavy documents |
| Reversibility | Fully reversible | Not reversible |
Code Example
// Example: Using PDFly's client-side API
const file = document.getElementById('file-input').files[0];
const arrayBuffer = await file.arrayBuffer();
// Process PDF entirely in the browser
const result = await pdfly.process(arrayBuffer, {
operation: 'compress',
level: 'medium'
});
// Download the result
const blob = new Blob([result], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
window.open(url);