Get coordinates from the pdf using itextsharp

怎甘沉沦 提交于 2019-12-08 09:36:51

问题


I have done something like this:

        PdfReader reader = new PdfReader("cde.pdf");
        TextWithPositionExtractionStategy S = new TextWithPositionExtractionStategy();
        PdfTextExtractor.GetTextFromPage(reader,1,S);


             Vector curBaseline = renderInfo.GetDescentLine().GetStartPoint();
            Vector topRight = renderInfo.GetAscentLine().GetEndPoint();

            iTextSharp.text.Rectangle rect = new iTextSharp.text.Rectangle(curBaseline[Vector.I1], curBaseline[Vector.I2], topRight[Vector.I1], topRight[Vector.I2]);
            string x1 = curBaseline[Vector.I1].ToString();
            string x2 = curBaseline[Vector.I2].ToString();
            string x3 = topRight[Vector.I1].ToString();
            string x4 = topRight[Vector.I2].ToString();

But,what i got is the coordinates of a string,not a word.How can i modify the code so that i can get the word coordinate. Thanks.

来源:https://stackoverflow.com/questions/13703006/get-coordinates-from-the-pdf-using-itextsharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!