C#使用iTextSharp從PDF文檔獲取內(nèi)容的方法
本文實(shí)例講述了C#使用iTextSharp從PDF文檔獲取內(nèi)容的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using iTextSharp.text.pdf; using iTextSharp.text.pdf.parser; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); ExtractTextFromPDFPage("c:\sample.pdf", 1); } public void ExtractTextFromPDFPage(string pdfFile, int pageNumber) { PdfReader reader = new PdfReader(pdfFile); string text = PdfTextExtractor.GetTextFromPage(reader, pageNumber); try { reader.Close(); } catch { } richTextBox1.Text = text; } } }
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
protobuf對(duì)象二進(jìn)制序列化存儲(chǔ)(詳解)
下面小編就為大家?guī)?lái)一篇protobuf對(duì)象二進(jìn)制序列化存儲(chǔ)(詳解)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-02-02C#實(shí)現(xiàn)簡(jiǎn)單的窗口抖動(dòng)
這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)簡(jiǎn)單的窗口抖動(dòng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-11-11C#通過(guò)oledb訪問(wèn)access數(shù)據(jù)庫(kù)的方法
這篇文章主要介紹了C#通過(guò)oledb訪問(wèn)access數(shù)據(jù)庫(kù)的方法,實(shí)例分析了C#操作access數(shù)據(jù)庫(kù)的相關(guān)技巧,需要的朋友可以參考下2015-06-06C#與SQL連接:GridView控件對(duì)數(shù)據(jù)庫(kù)的操作
GridView控件操作方面的知識(shí),需要的朋友可以參考一下2013-02-02c#讀寫App.config,ConfigurationManager.AppSettings 不生效的解決方法
這篇文章主要介紹了c#讀寫App.config,ConfigurationManager.AppSettings 不生效的解決方法,需要的朋友可以參考下2015-10-10C#通過(guò)屬性名字符串獲取、設(shè)置對(duì)象屬性值操作示例
這篇文章主要介紹了C#通過(guò)屬性名字符串獲取、設(shè)置對(duì)象屬性值操作,結(jié)合實(shí)例形式總結(jié)分析了C#通過(guò)反射獲取對(duì)象屬性值并設(shè)置屬性值,獲取對(duì)象的所有屬性名稱及類型等相關(guān)操作技巧,需要的朋友可以參考下2020-03-03