PDF guides

Compare PDF Text Blocks, Lines and Simple XML

·

Choose an XML layout for the program that will read the result. A coordinate layout helps you inspect positioned PDF text. A simple text layout can be easier to ingest when you only need the words grouped by page.

PDF to XML

Read the page geometry and coordinates

Load the ridge practice PDF and leave Hierarchical, Standard entities and Include document properties selected. Convert and open the XML. Page 1 is 300 × 220 points. Its first text segment starts at x=34, y=38. Page 2 has displayed dimensions 280 × 210 points and rotation 90. Page 3 is marked empty.

The metadata header contains the title Ridge & Creek <proof>. In the default markup the ampersand and angle brackets are escaped. Switch to Flat to see one line per element, with the baseline position of its first text segment.

Download the ridge survey practice PDFOpen PDF to XML

Read the same text from a simpler XML layout

Choose Simple, CDATA sections and Exclude document properties. Convert again. A parser reads the characters ]]> on the first page because the serializer splits the enclosing CDATA around that sequence. The new XML omits the metadata header.

Open or import a saved XML file with a parser and compare the decoded strings. Escaped entities and CDATA can represent the same characters while looking different in a text editor.

Open PDF to XMLW3C XML 1.0 CDATA sections

Work with readable segments and page boundaries

The positions describe drawn text baselines from the displayed top-left corner in points. Segment widths describe text advances. The output includes PDF content order. A flat line is inferred from reader line breaks and positions.

Use the original PDF if you need the appearance, graphics, link destinations or form behavior. The XML represents extracted text and optional standard document information. A graphics-only page remains in the file with an empty text status.

Open PDF to XMLW3C XML 1.0 CDATA sections

Common questions

What do the X and Y positions in exported XML mean?

They locate the text baseline on the displayed PDF page. X increases to the right and Y increases downward. Values are in PDF points.

Sources

Put it into practice.

Related guides