使用itextsharp从pdf获取坐标

时间:2012-12-04 12:33:27

标签: c# itextsharp

我做过这样的事情:

        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();

但是,我得到的是一个字符串的坐标,而不是一个单词。如何修改代码,以便我可以获得单词坐标。 感谢。

0 个答案:

没有答案