Adobe PDF Library 21 is now available! Get your free trial of 21 today
Developer Resources

How to Build an Automated PDF Optimization Pipeline: Architecture Guide

#PDF Optimizer #PDF Optimization #Archiving
Published March 31, 2026

Say your system ingests 500,000 PDFs a month. Each one has to be compressed to a consistent size, checked for structural integrity, and archived as PDF/A. No team can do that by hand, and any tool that needs a person to touch each file will stall long before you reach that volume. What you need is an automated PDF optimization pipeline.

Below are three pipeline patterns, each with its architecture, the tools involved, and the command syntax: simple batch processing for scheduled jobs, event-driven processing for documents that arrive continuously, and a compliance archival pipeline for PDF/A retention.

The Tools: PDF Checker and PDF Optimizer

Every pipeline in this post uses two Datalogics tools that are designed to work together.

ToolRole in the pipeline
PDF CheckerDiagnostic tool that validates PDFs before they enter processing. Finds structural errors, unembedded fonts, invalid color spaces, and other issues that cause downstream failures.
PDF OptimizerOptimization engine that performs compression, color conversion, PDF/A conversion, and other operations based on a JSON profile you define.

PDF Checker is included free with every PDF Optimizer purchase. Running it before PDF Optimizer is the right architecture for any production pipeline: validate first, then optimize, then archive or deliver.

Pattern 1: Simple Batch Processing

The simplest pipeline processes a directory of PDFs on a schedule. A cron job or task scheduler triggers PDF Checker on an input directory, passes the validated files to PDF Optimizer with a defined JSON profile, and writes the output to a delivery or storage directory.

The command structure for PDF Optimizer batch processing is straightforward. You specify the input file or directory, the JSON profile to apply, and the output location. A typical production command looks like this:

bash
pdfoptimizer -i /input/batch/ -p profiles/compressionMedium.json -o /output/compressed/ -r results.json
FlagPurpose
-iInput file or directory
-pJSON profile to apply
-oOutput location
-rResults report

The -r flag generates a results report that gives you a log of input size, output size, operations applied, and any warnings or errors encountered. This report is essential for monitoring pipeline health and auditing optimization outcomes at scale.

The JSON profile is your control mechanism

For this pattern, the JSON profile does the work. Every setting in a profile is optional and off by default, so you control exactly what changes in each document.

ProfileTypical settings
Medium compression (compressionMedium.json)Downsample color images to 150 DPI, apply JPEG compression at quality 75, remove embedded thumbnails and JavaScript.
High compression (compressionHigh.json)Target 96 DPI for screen-only documents with more aggressive recompression.

Define profiles once, store them in version control, and apply them consistently to every document in the pipeline. PDF Optimizer also ships with predefined profiles (compressionMedium.json, compressionHigh.json, PDFA-1b.json, PDFA-3u.json, and printing.json) that you can use as-is or modify.

Related reading: How to Configure PDF Optimizer JSON Profiles | PDF Image Downsampling and Recompression

Pattern 2: Event-Driven Processing

For systems where documents arrive continuously rather than in scheduled batches, an event-driven architecture is more appropriate. A document upload triggers a processing event that invokes PDF Checker, then PDF Optimizer, and then routes the output to the right destination based on the results.

Choosing a trigger

The triggering mechanism depends on your infrastructure.

  • Cloud: use an object storage event notification. When a new file lands in a raw documents bucket, it triggers a function or container that runs the processing steps. A message queue (SQS, Pub/Sub, or Service Bus) between the upload event and the processing container smooths out bursts of uploads.
  • On-premises: use a file system watcher, or a message queue that receives document processing requests.

Failed events go back through a retry path, with a dead-letter queue (DLQ) catching anything that keeps failing so it can be inspected without blocking the rest of the pipeline.

Design for idempotency

The key design principle for event-driven pipelines is idempotency: the same document should produce the same output no matter how many times it is processed. JSON profiles make this straightforward. The same profile applied to the same input will always produce the same output, so you can safely retry failed processing events without risking inconsistent results.

Send results to a database, not a flat file

In this pattern, the results report from PDF Optimizer is typically written to a database or monitoring system rather than a flat file. That lets you query optimization outcomes across your entire document inventory:

  • Which documents were reduced by more than 50%?
  • Which documents failed validation?
  • Which documents produced warnings?

The report data answers these questions at scale.

Pattern 3: Compliance Archival Pipeline

The most sophisticated pattern combines validation, optimization, and compliance conversion in a single automated workflow. It is the right architecture for organizations that must archive documents to PDF/A for regulatory, legal, or institutional retention requirements.

The five stages

  1. Intake
  2. Validation. PDF Checker runs here and produces a per-document report.
  3. Optimization and compliance conversion. Documents that pass validation move to PDF Optimizer, which applies both compression and PDF/A conversion in a single pass.
  4. Audit logging. Results JSON, logs, checksums, and metadata are stored for audit.
  5. Archive storage. PDF/A-compliant files are stored for long-term retention.

Documents that fail validation are routed to a review queue for manual inspection.

A different kind of profile

The JSON profile for a compliance pipeline looks different from a compression-only profile. Rather than prioritizing aggressive size reduction, it prioritizes compliant output:

  • Font subsetting is enabled
  • JavaScript and XFA are removed
  • Color spaces are explicitly converted to PDF/A-compliant profiles
  • Transparency is flattened

The output is both smaller and ISO-compliant.

bash
pdfoptimizer -i /input/documents/ -p profiles/PDFA-3u.json -o /archive/pdfa/ -r /logs/archive_results.json

Delivery and archive from the same source

Some workflows need both a compressed delivery version and a compliant archive version of the same document. Run PDF Optimizer twice with two different profiles. Because processing is automated and the profiles are predefined, the extra step adds almost no operational overhead.

Related reading: PDF Optimizer for Compliance Archiving: Converting PDFs to PDF/A at Scale | PDF/A vs. PDF/X vs. PDF 2.0

Monitoring and Reporting

Any production pipeline needs observability. PDF Optimizer's results output provides the raw data: input size, output size, compression ratio, operations applied, and any errors or warnings per document. At scale, that data should flow into a monitoring system, not sit in flat log files.

A practical approach is to parse the results JSON after each batch run, aggregate the key metrics, and push them to whatever monitoring or logging infrastructure your team uses. Track these over time:

  • Average compression ratio
  • Validation failure rate
  • Processing throughput

Anomalies in any of these, such as a sudden drop in compression ratio or a spike in validation failures, point to changes in your incoming document quality that need investigation.

FAQ

What is the right order for a PDF optimization pipeline?

Validate first, then optimize, then archive or deliver. Running PDF Checker before PDF Optimizer catches structural errors, unembedded fonts, and invalid color spaces before they cause downstream failures.

Does PDF Optimizer include PDF Checker?

Yes. PDF Checker is included free with every PDF Optimizer purchase.

How do I keep results consistent across millions of documents?

Use JSON profiles. Define each profile once, store it in version control, and apply it to every document. The same profile and the same input always produce the same output, which also makes retries safe in event-driven systems.

Can PDF Optimizer compress and convert to PDF/A in one pass?

Yes. A compliance profile can apply compression operations and PDF/A conversion together, so documents do not need a second processing run.

What should I monitor in a production pipeline?

Track average compression ratio, validation failure rate, and processing throughput. Sudden changes in any of them usually signal a change in incoming document quality.

Next Steps

A reliable PDF pipeline starts with two tools that work together: PDF Checker to validate every document before it enters processing, and PDF Optimizer to compress, convert, and archive it using a JSON profile you define once and apply everywhere. PDF Checker is included free with every PDF Optimizer purchase.

Start with the pattern that fits your workflow. Run a predefined profile on a sample of your own documents, review the results report, and adjust the profile before you scale up to a full batch.

Questions about profile configuration or pipeline architecture? Contact us or set up a meeting with a software engineer today.