
Back
Legal & Contract Analysis
Turning 345 Pages of Scanned Federal Tariff Schedules Into a Cited, AI-Searchable Corpus
How Pfactorial Technologies converted scanned tariff and trade-compliance PDFs into a structure-preserving, page-cited corpus that powers a grounded search application.
August 21, 2026
Share
ENGAGEMENT SNAPSHOT

Figure 1 - Key figures from this engagement, at a glance.
EXECUTIVE SUMMARY
Our client holds a large backlog of government tariff and trade-compliance notices that need to become searchable - documents like Federal Register Section 301 notices, running hundreds of pages, that classify products by HTS heading and set duty treatment. Historically, finding the answer to a single classification question meant a manual search through a filing cabinet of scanned paper.
A standard PDF-extraction tool doesn't solve this, because it isn't a text problem - it's a scanning problem. Across the 345-page sample document, 89% of pages are effectively scanned images with no usable text layer underneath, and the tariff tables inside them are exactly the content a naive extraction would mangle: rows have to stay attached to their column headers and surrounding schedule, or a recovered number becomes meaningless.
Pfactorial built a structure-preserving OCR and ingestion pipeline that processes each page, rebuilds tables and their headings intact, links every extracted passage back to its exact page and location in the original PDF, and loads the result into a working, citation-backed search application - proving the conversion is correct by building its own end use, not just producing a data dump.
Why this engagement is representative This engagement demonstrates Pfactorial's ability to take a document-conversion claim and prove it end-to-end - not a text-extraction script handed back as a deliverable, but a working, page-cited search application that a reviewer can click through to verify against the source.
THE CHALLENGE
Converting tariff notices into something searchable ran into problems that only surface once you've actually opened all 345 pages rather than sampled a few.
1. Most of the document is a scan, not text
308 of 345 sample pages carry a text layer under 400 characters - effectively a picture of a page, not machine-readable content, so a standard PDF text extractor recovers almost nothing usable.
2. OCR alone recovers text but destroys structure
The tariff tables are embedded as black-and-white scans; running OCR page by page without rebuilding table structure produces a wall of numbers disconnected from the column headers and schedule context that give them meaning.
3. The gap between text-layer and OCR-recovered content is enormous, not marginal
The PDF text layer alone surfaces only 138 distinct HTS codes; OCR recovers 4,221 - meaning 97% of the tariff codes in this document were invisible to any tool that skips OCR.
4. A converted corpus is worthless if it can't be verified against the source
Trade-compliance answers carry real consequences, so every extracted passage needs a traceable link back to its original Annex, Part heading, page number, and exact location on the page - not just a plaintext blob in a database.
The real brief Not "extract the text from these PDFs" but "rebuild a scanned regulatory document into a structure-preserving, page-cited corpus a compliance user can trust and verify with one click."
THE SOLUTION
Pfactorial built a repeatable, page-by-page OCR and ingestion pipeline that treats prose and tariff tables differently, preserves every structural anchor, and feeds a database of record plus a vector index that together power a live, cited search application.

Figure 1 - Every page moves through OCR and structure-aware parsing before it becomes queryable; retrieval then reunites a query with its exact source page.
Architectural principles
- Verify the pipeline works before shipping it - the deliverable is not the conversion script, it's a working search application over the converted output - the strongest evidence that structure was preserved correctly is that the application answers real classification questions correctly.
- Tables are a first-class structure, not incidental text - the pipeline keeps every tariff table row bound to its column headers and surrounding schedule, because a recovered number without its header is not a recovered fact.
- Every passage stays traceable to its exact source - Annex/Part heading, original page number, and on-page location travel with every extracted section, so a citation opens the real PDF page with the passage outlined rather than asking the user to trust a summary.
- Retrieval has to handle both exact codes and natural language - combining meaning-based and exact-code search means a bare HTS code lands on the right schedule just as reliably as a plain-English product description does.
CAPABILITIES DELIVERED
Each capability turns a scanned regulatory document into something a compliance user can query directly, with the source always one click away.
CAPABILITY | WHAT IT DOES |
|---|---|
Structure-preserving OCR | Recovers text from scanned pages while keeping tariff tables intact - each row still bound to its column headers and schedule. |
Page-level citation | Every extracted passage retains its Annex/Part heading, original page reference, and exact on-page location. |
Grounded, cited search | Users search by tariff heading, HTS code, or product description and receive a clear answer with numbered citations. |
One-click source verification | Clicking a citation opens the original PDF page with the cited passage outlined, plus page navigation and zoom. |
Hybrid retrieval | Combines meaning-based and exact-code search so a bare HTS code query resolves reliably to its schedule and page. |
Dual source-of-record storage | Structured content lands in both a database of record and a vector index, so the same converted content powers lookup and semantic search. |

Figure 2 - The same pipeline that recovers the content also proves it, by powering a live cited-answer search application over it.
Design note The application was built as proof of the conversion, not as a separate product - the fact that it can answer a real HTSUS heading question with a correct duty-treatment result, sourced to the exact converted page, is what a technical reviewer would otherwise have to take on faith from a conversion report alone.
ENGINEERING FOR SCALE AND RELIABILITY
Four decisions kept the pipeline reliable enough to trust as a source of compliance answers rather than a best-effort text dump.
OCR applied uniformly, page by page, rather than selectively
Every page goes through the same OCR and ingestion pipeline regardless of whether its text layer looks usable, because the sample document showed that a text layer under 400 characters is not a reliable signal to skip a page - it's the majority case.
Tables parsed as structure, not flattened to text
Rows keep their bound relationship to column headers and the surrounding schedule through ingestion, because a tariff figure separated from its header is not a usable fact regardless of how accurately the OCR read the digits.
Two storage targets from one ingestion pass
The same structured content is written to a database as the source of truth and to a vector index for search, so the retrieval layer and the record layer never drift out of sync with each other.
Hybrid retrieval instead of pure semantic search
Meaning-based and exact-code search are combined, because trade-compliance queries range from natural-language product descriptions to bare HTS codes, and a purely semantic index handles the latter unreliably.
DELIVERY APPROACH
The engagement proved the pipeline against one full sample document before proposing terms for the remaining volume.
1. Baseline finding - reviewed all 345 pages of the sample document to establish that 89% were effectively scans, defining the project as an OCR-and-structure problem rather than a text-extraction one.
2. OCR pipeline - built the page-by-page OCR process applied uniformly across the sample document.
3. Structure-aware ingestion - built the parsing layer that separates prose from tariff tables and preserves Annex/Part headings, page references, and on-page location for every section.
4. Dual storage layer - wired ingestion output into both a database of record and a vector index.
5. Search application - built the live application that returns cited answers by tariff heading, HTS code, or product description, with hybrid meaning-based and exact-code retrieval.
6. Verification and proposal - used the working application to demonstrate correct, cited answers on the converted sample, then scoped a fixed-price plan for converting the remaining document volume.
RESULTS AND IMPACT

- Key outcomes from this engagement.
The sample document is fully converted and live: 4,221 distinct HTS codes are now searchable where only 138 were visible in the original PDF text layer, and every answer the application returns is backed by a numbered citation that opens the exact source page.
Because the same pipeline and application already work end-to-end on a real, representative document rather than a synthetic test case, the remaining conversion work is a scaling exercise on a proven process, not an open technical question.
What it enabled commercially
With the pipeline proven against a full 345-page document and a working cited-search application to show for it, the client can now scope and commit to converting its remaining tariff document backlog under a fixed-price plan, with the conversion risk already retired.
WHY PFACTORIAL
This engagement reflects Pfactorial's document-intelligence practice - turning scanned, structurally complex regulatory content into a corpus that's not just extracted but provably correct, verified by building the real application on top of it rather than handing back a text dump.

- Service lines this engagement draws on.
Engagement enquiries Pfactorial Technologies works with organisations sitting on large volumes of scanned or structurally complex regulatory, legal, or compliance documents that need to become genuinely searchable. If you're evaluating a document-conversion or AI-search project, we're happy to give you an honest read on scope and risk before anyone commits to anything. · pfactorial.ai
APPENDIX A - TECHNOLOGY STACK
The technology stack underpinning the system, grouped by the layer it serves.

Result and Analysis
ENGAGEMENT SNAPSHOT
How Pfactorial Technologies converted scanned tariff and trade-compliance PDFs into a structure-preserving, page-cited corpus that powers a grounded search application.
CASE STUDIES
You might also like...

OCR & Document ExtractionRAG & Semantic SearchFinance & Payments
Aug 21, 20267 min readRead

OCR & Document Extraction
A Multi-Format Document Extraction Platform Built Around One OCR Contract
Aug 21, 20268 min readRead

Conversational AI & ChatbotsRAG & Semantic Search
A Retrieval-Augmented Chat Interface Over Structured Tax Records
Aug 21, 20267 min readRead

Conversational AI & ChatbotsRAG & Semantic SearchEnterprise Ops Platforms
An OCR and RAG Platform for Conversational Document Intelligence
Aug 21, 20268 min readRead

Legal & Contract Analysis
Architecting a Continuously Updated Legal Intelligence Platform
Aug 21, 20268 min readRead

Machine LearningOCR & Document ExtractionNatural Language Processing+4
Automating SEC and SEDAR Agreement Processing: A Machine Learning Approach
May 18, 202611 min readRead





