04-23.eri-test 答案:使用PDFbox确定文档中单词的坐标

\n

I\'m working on extract data from PDF files. This post helps me to determine for the coordinate position by word searching.

\n\n\n
\n
\n \n
\n

\n 04-23.eri-test 答案:使用PDFbox确定文档中单词的坐标_第1张图片\n \n answer re: Using PDFbox to determine the coordinates of words in a document\n \n

\n \n
\n \n \n
\n 1\n
\n \n \n \n
\n
\n \n

take a look on this, I think it\'s what you need.

\n

https://jackson-brain.com/using-pdfbox-to-locate-text-coordinates-within-a-pdf-in-java/

\n\n

Here is the code:

\n\n
import java.io.File;\nimport java.io.IOException;\nimport java.text.DecimalFormat;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.apache.pdfbox.exceptions.InvalidPasswordException;\nimport org.apache.pdfbox.pdmodel.PDDocument;\nimport org.apache.pdfbox.pdmodel.PDPage;\nimport org.apache.pdfbox.pdmodel.common.PDStream;\nimport org.apache.pdfbox.util.PDFTextStripper;\nimport org.apache.pdfbox.util.TextPosition;\n\npublic class PrintTextLocations extends PDFTextStripper {\n\npublic static StringBuilder tWord
\xe2\x80\xa6\n \n
\n
\n \n Open Full Answer\n \n
\n
\n\n\n\n

你可能感兴趣的:(java)