[英]How to get (x,y width height )of any given word in pdf using java
I need to get x,y ,width and height of a given word in pdf. 我需要获取pdf中给定单词的x,y,宽度和高度。 so that later while parsing the same type of file i can fetch value from the co-ordinate itself.
这样,稍后在解析相同类型的文件时,我就可以从坐标本身获取值。 How should i get position of a word from PDF using java.
我应该如何使用Java从PDF中获取单词的位置。
Rectangle rect = new Rectangle(451, 125,100,1); // i need to get this co-ordate for any particular word
stripper.addRegion("class1", rect);
stripper.extractRegions(pdDocument.getPage(0));
System.out.println("stripper "+stripper.getTextForRegion("class1").trim());
我认为您可以利用Apache的PDFBox
API并遵循这个类似问题的建议, 该问题专门针对该API编写您所需的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.