PDF data guides

Compare PDF text coordinates on a turned page

·

A PDF can show a printed page label and landscape view while using a different physical page number and coordinate system. Compare these fields before sending text coordinates to another tool.

PDF to JSON

Read the Stock 5 page at physical page 2

Download and open the coordinate sample PDF. Type 2 in Pages and read the file. The selected page has physical number 2 and source label Stock 5. Its rotated viewport is 300 × 400 points at 90 degrees.

Find Turned card in the preview. Its baseline starts at viewport X 180.5 and Y 70.25. Download JSON and verify those exact numbers in the item origin.

Mozilla PDF.js — Page viewport

Check the content sequence on physical page 1

Change Pages to 1 and read the file. Lower note appears before Shelf check in the text items even though it sits farther down the visible page. The exported item origins show the difference between position and the PDF text sequence.

Choose Grouped lines only to export each group’s text and first and last item numbers alongside the page geometry.

Mozilla PDF.js — Text items

Choose the JSON contents for the next application

Text items only keeps each PDF.js item with its font key, original transform and viewport origin. Grouped lines only keeps the adjacent line groups. Keep both when you want to trace a group back to its source items.

The JSON retains the file’s page count and document information fields in every mode. A scanned or blank page can have geometry and an empty text array.

Mozilla PDF.js — Text items

Common questions

Does the preview round my exported coordinates?

The preview displays two decimal places. The downloaded JSON uses the original numeric coordinates computed from the PDF.js viewport transform.

Can I open a PDF that needs a password?

Enter the correct password in the workspace before reading. PDF.js opens the file locally.

Sources

Put it into practice.

Related guides