itextsharp and pdf

i want to read a pdf file line per line but i want to maintain his original format

¿can i do this with itextsharp?

i use the next code :

private void button1_Click(object sender, EventArgs e)
        {

            string text = string.Empty;
            string path = string.Empty;
            path = "C:Documents and SettingsRafaelDesktopImprimiendoPrint1.pdf";
            PdfReader reader = new PdfReader(path);

            for (int page = 1; page <= reader.NumberOfPages; page++)
            {
                text = PdfTextExtractor.GetTextFromPage(reader, page);
                richTextBox1.Text = text;

            }
            reader.Close();
            return;
        }

thanks, i really need your help


If you want to read PDF file with small data in it, iTextsharp would be the best choice, you may find answer here:

Reading PDF content with itextsharp dll in VB.NET or C#

However, if you have huge data in your PDF file, iTextsharp will have problems in realizing this task. in such a case, you may need a third party library. This article may help you much:

Read PDF file in C#

链接地址: http://www.djcxy.com/p/46738.html

上一篇: 使用iTextSharp删除PDF不可见对象

下一篇: itextsharp和pdf