
Resize PDF Pages for Consistent Archiving
Give Every Archived PDF the Page Geometry Your Repository Requires
An archive is only as consistent as the files it receives. Case records, forms, scanned receipts, and imported attachments can arrive with different page dimensions and boundary definitions even when they belong in the same collection. That inconsistency complicates predictable display, print handling, and downstream document processing.
The pdfRest Set Page Boxes API Tool gives an archival workflow precise, programmatic control over PDF page boundaries. MediaBox defines the physical page boundary. CropBox defines the area a viewer or printer normally displays. BleedBox and TrimBox support production boundaries, while ArtBox identifies the meaningful artwork region.
When an archive needs a consistent stored page boundary, Set Page Boxes provides the targeted operation behind “resize PDF pages.” The application applies its approved page policy across a collection instead of asking a person to open and adjust documents one by one.
Identify Mixed Page Geometry Before You Standardize It
The Query PDF API Tool includes a page_boxes query that returns the MediaBox, CropBox, BleedBox, TrimBox, and ArtBox coordinates for every page. It also indicates whether the other boxes match the MediaBox. This gives the ingest workflow the facts it needs to identify mixed dimensions and calculate the adjustments required by its target policy.
For example, an archive may receive a case file assembled from letter-size forms, scanned receipts, and attachments exported from another system. The application reads the page geometry, assigns the document to the right page-size rule, and calculates the MediaBox edge adjustments in PDF units. Since 72 PDF units equal one inch, the workflow can map its archive standard directly into the API request.
Apply Your Page Policy Across Every Relevant Page
The /pdf-with-page-boxes-set endpoint accepts a JSON-formatted boxes parameter. Each object names a box type and contains page-range instructions with top, bottom, left, and right adjustments. Ranges can target one page, a numeric range, all, even, odd, or expressions that use last.
One request can update several box types or apply different settings to different page groups. A preservation workflow can standardize MediaBox across all pages while retaining a defined CropBox for the visible record area. A digitization system can apply another policy when scans include excess boundary space.
This is a focused page-geometry operation: it changes the selected PDF boxes rather than proportionally scaling the text, images, or vector artwork on the page. That precision lets the application choose the right treatment for the archive requirement instead of applying a generic resize operation that changes more than the record policy calls for.
Set the PDF MediaBox Across All Pages
The following GitHub-aligned cURL request applies a MediaBox adjustment to every page using the documented boxes JSON structure.
Set PDF MediaBox Across All Pages 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"
# Replace the edge adjustments with values calculated from the archive's page policy.
BOXES='{"boxes":[{"box":"media","pages":[{"range":"all","left":100,"top":100,"bottom":100,"right":100}]}]}'
curl -X POST "$API_URL/pdf-with-page-boxes-set" \
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data" \
-H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
-F "file=@/path/to/archive_record.pdf" \
-F "boxes=$BOXES" \
-F "output=standardized_archive_record"
Use API Lab to configure page ranges and boundary changes. The Set Page Boxes and Query PDF references provide the current request and response fields.
Set Page Boxes |