Get the exact Stringposition in PDF

前端 未结 3 1648
灰色年华
灰色年华 2020-11-30 12:10

I tried to read a stream and was hoping to get for each String the exact position (coordinates)

    int size = reader.getXrefSize();

    for (int i = 0; i         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 12:49

    If you're trying to do text extraction, you should be aware that the this is decidedly a non-trivial process. You will, at a minimum, have to implement an RPN machine to run the code and accumulate transformations and execute all the text operators. You will need to interpret the font metrics from the current set of page resources and you will likely need to understand the text encoding.

    When I worked on Acrobat 1.0, I was responsible for the "Find..." command which included your problem as a subset. With a richer set of tools and more expertise, it took a couple months to get it right.

提交回复
热议问题