简体   繁体   English

itextsharp和pdf

[英]itextsharp and pdf

i want to read a pdf file line per line but i want to maintain his original format 我想每行读取一个pdf文件,但我想保持他的原始格式

¿can i do this with itextsharp? 我可以用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 Settings\\Rafael\\Desktop\\Imprimiendo\\Print1.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: 如果您想读取其中包含少量数据的PDF文件,iTextsharp将是最佳选择,您可以在这里找到答案:

Reading PDF content with itextsharp dll in VB.NET or C# 在VB.NET或C#中使用itextsharp dll读取PDF内容

However, if you have huge data in your PDF file, iTextsharp will have problems in realizing this task. 但是,如果您的PDF文件中包含大量数据,则iTextsharp将在实现此任务时遇到问题。 in such a case, you may need a third party library. 在这种情况下,您可能需要第三方库。 This article may help you much: 本文可能对您有很大帮助:

Read PDF file in C# 用C#读取PDF文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM