PDF Compare API for text and form fields
When someone sends a revised form, find the changed text and form fields before replacing the file your automation uses. The PDF Compare API returns before/after excerpts, page references, changed field definitions and review steps as JSON, with a readable HTML report in the run’s Output.
Sign in to Apify, click Start with the included IRS sample, then open the Dataset. You do not need to upload a file or configure a store for this example.
The hosted sample compares the 2025 and 2026 editions of IRS Form
1040-ES and returns one CHANGES_FOUND row:
| Check | Recorded result |
|---|---|
| Pages | 12 before, 16 after |
| Field and grouping names | 127 missing, 128 added |
| Word occurrences | 273 missing, 2,276 added |
Legacy field counts include AcroForm grouping nodes, so use the typed
fieldChanges findings to distinguish fillable fields from
containers. The counts are a summary, while textChanges
contains before/after excerpts and page references, and
fieldChanges lists the exact field or grouping names and
changed definitions. A renamed field can count as one removal and one
addition; the tool does not guess which new field replaces an old one.
Word counts describe extracted occurrences rather than a visual
redline.
See what someone would do with the result
Open a real W-9 change report, produced by comparing the official 2018 W-9 with the March 2024 W-9. Open the first page pair to see the new line 3b wording and its added explanatory passage.
For this controlled example, we declared an old Address field name as a required automation mapping. The revised file does not have that exact name, so the report puts the missing mapping first and asks you to verify a replacement and test the workflow before switching files. It does not claim that the address question disappeared or that the form is legally unsuitable.
This is the handoff: read the changed passage, review any instruction or mapping that depends on it, then test that affected case. The tool shows evidence and a conditional review step; it does not decide which tax rules apply to you. W-9 contains XFA, so this example explicitly requires checking the form in its intended application.
Text comparison follows extracted PDF reading order. Reordered text may appear as additions or removals, and side-by-side fragments are not a verified semantic replacement. Scans, ambiguous page matches and truncated output are flagged for manual review.
Run the PDF comparison by API
Set APIFY_TOKEN in your environment using an Apify API
token, then paste this block into a terminal from any folder. It
downloads the sample input before making one live request, with a $0.02
maximum total charge. Apify may charge your account.
curl --fail --silent --show-error https://toolshed-guides.vercel.app/examples/pdf/input.json -o toolshed-pdf-input.json &&
curl --fail-with-body --silent --show-error --max-time 110 \
'https://api.apify.com/v2/actors/koHaO9g0bPo9j1HrG/run-sync-get-dataset-items?maxTotalChargeUsd=0.02&timeout=90&format=json' \
-H "Authorization: Bearer $APIFY_TOKEN" -H 'Content-Type: application/json' \
--data-binary @toolshed-pdf-input.jsonDownload the request JSON or inspect the recorded result before running. If a live request times out, check Apify Runs before retrying, because the run may already have started. Current pricing.
Prefer Python? Download the source
ZIP, unzip it, and run python3 run_demo.py pdf --live
from its folder. Python 3.8+ is enough, with no packages to install.
Leaving off --live prints a recorded preview without making
a request.
Check the unchanged-file control
In the Actor input, set PDF pair to Same-file control: two
copies of the 2025 edition and run it. The expected result is
PRESERVED_ON_CHECKS, with 12 pages in each copy and zero
added or missing field names and word occurrences. This status means the
implemented checks passed; it does not certify layout or form
behavior.
The same control is available as request JSON, recorded result, or
python3 run_demo.py pdf-control --live in the source
download.
Compare your own PDFs
- In Apify Storage, create a private key-value store and upload the
original as
BEFORE.pdfand the revision asAFTER.pdf, usingapplication/pdfcontent type. - Open the Actor input, choose My two PDFs in a private Apify store, and select that store in Private PDF store. Grant read access when prompted, then enter the two record keys.
- Optionally supply
requiredFieldNameswith the exact names your integration uses. A missing name is a mapping review item, not a guessed rename. - Run the comparison and open CHANGE_REPORT.html in
Output, or use
textChanges,fieldChanges,requiredFieldChecksandreviewWarningsfrom JSON. RouteMISSING_REQUIRED_FIELDSandMANUAL_REVIEW_REQUIREDto human review; only switch files after testing the affected workflow.
Both files must be valid, readable PDFs. The Actor checks extracted
text and AcroForm field definitions, including names, types, flags,
choices and known page locations. It does not perform OCR, visual
comparison, validation of filled values or signature validation.
NO_SUPPORTED_CHANGES means the supported checks found no
change, while downstream compatibility remains NOT_TESTED.
Limits are 12 MiB and 100 pages per PDF, with explicit finding and
excerpt caps. For a recurring form update, keep the original file as
your baseline and compare each revision before replacing it. The Actor
does not watch your files automatically.
For coding agents, the stable Actor ID is
koHaO9g0bPo9j1HrG. Read the current
OpenAPI schema and use the exact sample input above before sending
authorized private files. A run success alone is not the comparison
result.
Agent payment budgets
For a prepaid agent token, current permissions and prices, and recovery after an interrupted request, use the agent payment guide. Its preflight command does not spend money. A funded AGI run remains a separate, untested validation step.
Check form templates before replacing them
For an automated fillable-form workflow, supply requiredFieldNames to flag missing saved mappings, then review changed AcroForm names, types, flags, choices and page references in CHANGE_REPORT.html. This is a supported-definition comparison, not a promise that downstream filling, visual layout, signatures or XFA behavior remain compatible. ChatGPT or a local PDF library may be simpler for a one-off readable-text question.
Recorded sample · no login
Inspect the input and output
Show request JSON
{
"samplePair": "irs_2025_vs_2026"
}Show selected result fields
[
{
"result": "CHANGES_FOUND",
"beforePages": 12,
"afterPages": 16,
"missingFormFieldNames": 127,
"addedFormFieldNames": 128,
"missingWordOccurrences": 273,
"addedWordOccurrences": 2276,
"reviewStatus": "MANUAL_REVIEW_REQUIRED",
"downstreamCompatibility": "NOT_TESTED"
}
]The API command above downloads its own input and sets a $0.02 charge cap.
Read the live OpenAPI schema before making a paid request.
More Toolshed guides: YouTube transcript API · PDF Compare API · Supplier CSV price comparison · All APIs.