Apache Tika test for sample-technical.pdf

← Back to Apache Tika

Input: sample-technical.pdf

sample-technical.pdf first page preview
java -jar bin/tika-app-3.1.0.jar --text "sample-technical.pdf" >"sample-technical--apache-tika-java.txt"

Output: sample-technical--apache-tika-java.txt

Loading preview…

-J/--jsonRecursive: metadata + content (as JSON) from the file and any embedded/attached files, distinct from the flat --text dump above.

java -jar bin/tika-app-3.1.0.jar -J -t "sample-technical.pdf" >"sample-technical--apache-tika-java--recursive.json"

-T/--text-main: boilerpipe "main content" extraction, which strips boilerplate (headers/footers/repeated chrome) — designed for web articles, but worth a comparison point here since it's a genuinely different selection algorithm, not just a formatting change.

java -jar bin/tika-app-3.1.0.jar -T "sample-technical.pdf" >"sample-technical--apache-tika-java--text-main.txt"

--config with sortByPosition=true (see tests/config/tika-sort-by-position.xml): PDFParser's default reading order follows content-stream order, which can interleave multi-column/table-ish layouts. sortByPosition reconstructs order from glyph (x,y) coordinates instead — the fix pointed to by several Tika/PDF tutorials (Baeldung, StackOverflow) for that failure mode. Off by default upstream (slower, can misorder simple single-column docs), so kept as an explicit variant rather than replacing the default above.

java -jar bin/tika-app-3.1.0.jar --config=tests/config/tika-sort-by-position.xml -t "sample-technical.pdf" >"sample-technical--apache-tika-java--sort-by-position.txt"