中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

政府網(wǎng)站集群的建設(shè)思路百度查重免費(fèi)入口

政府網(wǎng)站集群的建設(shè)思路,百度查重免費(fèi)入口,免費(fèi)建站分類信息網(wǎng),18款禁用軟件app排行LEADTOOLS 是一個(gè)綜合工具包的集合,用于將識(shí)別、文檔、醫(yī)療、成像和多媒體技術(shù)整合到桌面、服務(wù)器、平板電腦、網(wǎng)絡(luò)和移動(dòng)解決方案中,是一項(xiàng)企業(yè)級(jí)文檔自動(dòng)化解決方案,有捕捉,OCR,OMR,表單識(shí)別和處理&#…

LEADTOOLS?是一個(gè)綜合工具包的集合,用于將識(shí)別、文檔、醫(yī)療、成像和多媒體技術(shù)整合到桌面、服務(wù)器、平板電腦、網(wǎng)絡(luò)和移動(dòng)解決方案中,是一項(xiàng)企業(yè)級(jí)文檔自動(dòng)化解決方案,有捕捉,OCR,OMR,表單識(shí)別和處理,PDF,打印捕獲,歸檔,注釋和顯示功能。利用業(yè)界領(lǐng)先的圖像處理技術(shù),能夠智能識(shí)別文件,可以用來識(shí)別任何類型的掃描或傳真形式的圖像。

LEADTOOLS 最新下載(qun:731259648)icon-default.png?t=N176https://www.evget.com/product/782/download

本教程介紹如何使用 LEADTOOLS SDK 在 C# Windows 控制臺(tái)應(yīng)用程序中提取包含在 PDF 文件中的附件。

概括本教程介紹如何在 C# Windows 控制臺(tái)應(yīng)用程序中提取 PDF 附件并將它們轉(zhuǎn)換為 PNG 文件。
完成時(shí)間30分鐘
視覺工作室項(xiàng)目下載教程項(xiàng)目 (3 KB)
平臺(tái)C# Windows 控制臺(tái)應(yīng)用程序
集成開發(fā)環(huán)境視覺工作室 2017、2019
開發(fā)許可LEADTOOLS
用另一種語言試試
  • C#:.?NET Framework(控制臺(tái)),.?NET 6+
  • 爪哇:

所需知識(shí)

在學(xué)習(xí)從 PDF 中提取附件 - 控制臺(tái) C#教程之前,通過查看添加引用和設(shè)置許可證教程熟悉創(chuàng)建項(xiàng)目的基本步驟。

創(chuàng)建項(xiàng)目并添加 LEADTOOLS 引用

從添加引用和設(shè)置許可證教程中創(chuàng)建的項(xiàng)目副本開始。如果您沒有該項(xiàng)目,請(qǐng)按照該教程中的步驟創(chuàng)建它。

所需的參考取決于項(xiàng)目的目的。可以通過以下兩種方法之一(但不能同時(shí)使用)添加引用。

如果使用 NuGet 引用,本教程需要以下 NuGet 包:

  • Leadtools.Document.Sdk

如果使用本地 DLL 引用,則需要以下 DLL。

DLL 位于<INSTALL_DIR>\LEADTOOLS22\Bin\Dotnet4\x64:

  • Leadtools.dll
  • Leadtools.Caching.dll
  • Leadtools.Codecs.dll
  • Leadtools.Codecs.Cmp.dll
  • Leadtools.Codecs.Png.dll
  • Leadtools.Document.dll
  • Leadtools.Document.Converter.dll
  • Leadtools.Document.Pdf.dll
  • Leadtools.Document.Raster.dll
  • Leadtools.Document.Writer.dll
  • Leadtools.Pdf.dll

有關(guān)您的應(yīng)用程序需要哪些 DLL 文件的完整列表,請(qǐng)參閱要包含在您的應(yīng)用程序中的文件。

設(shè)置許可證文件

許可證解鎖項(xiàng)目所需的功能。它必須在調(diào)用任何工具包函數(shù)之前設(shè)置。有關(guān)詳細(xì)信息,包括針對(duì)不同平臺(tái)的教程,請(qǐng)參閱設(shè)置運(yùn)行時(shí)許可證。

有兩種類型的運(yùn)行時(shí)許可證:

  • 評(píng)估許可證,在下載評(píng)估工具包時(shí)獲得。它允許評(píng)估工具包。
  • 部署許可證。如果需要部署許可證文件和開發(fā)人員密鑰,請(qǐng)參閱獲取許可證。

筆記

添加 LEADTOOLS NuGet 和本地引用以及設(shè)置許可證在添加引用和設(shè)置許可證教程中有更詳細(xì)的介紹。

添加PDF附件提取和轉(zhuǎn)換代碼

創(chuàng)建項(xiàng)目、添加參考和設(shè)置許可證后,就可以開始編碼了。

在解決方案資源管理器中,打開Program.cs。將以下語句添加到頂部的 using 塊中Program.cs:

[C#]

using System; 
using System.Collections.Generic; 
using System.IO; 
using Leadtools; 
using Leadtools.Caching; 
using Leadtools.Codecs; 
using Leadtools.Document; 
using Leadtools.Document.Converter; 
using Leadtools.Document.Writer; 

將以下全局變量添加到類中Program。

[C#]

static FileCache cache; 
static string OutputDir = "Output"; 

Program.cs在named中創(chuàng)建一個(gè)新方法ExtractPDFAttachments()。在set license調(diào)用下調(diào)用方法中的方法Main(),如下圖。

[C#]

static void Main(string[] args) 
{ try { SetLicense(); ExtractPDFAttachments(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(true); 
} 

將下面的代碼添加到ExtractPDFAttachments()方法中以從給定的 PDF 中提取附件。

static void ExtractPDFAttachments() 
{ cache = new FileCache { CacheDirectory = "\\cache" }; List<LEADDocument> documents = new List<LEADDocument>(); if (!Directory.Exists(OutputDir)) Directory.CreateDirectory(OutputDir); LoadDocumentOptions options = new LoadDocumentOptions { Cache = cache, LoadAttachmentsMode = DocumentLoadAttachmentsMode.AsAttachments }; LEADDocument document = DocumentFactory.LoadFromFile(@"FILE PATH TO PDF WITH ATTACHMENTS", options); if (document.Pages.Count > 0) documents.Add(document); foreach (DocumentAttachment attachment in document.Attachments) { LoadAttachmentOptions attachmentOptions = new LoadAttachmentOptions { AttachmentNumber = attachment.AttachmentNumber, }; LEADDocument loadDocument = document.LoadDocumentAttachment(attachmentOptions); documents.Add(loadDocument); } ConvertDocuments(documents, RasterImageFormat.Png); 
} 

在Program類中,添加一個(gè)名為 的新方法ConvertDocuments(IEnumerable<LEADDocument> documents, RasterImageFormat imageFormat)。該方法將在方法內(nèi)部調(diào)用ExtractPDFAttachments(),如上所示。將下面的代碼添加到ConvertDocuments()將 PDF 附件轉(zhuǎn)換為 PNG 文件的方法中。

static void ConvertDocuments(IEnumerable<LEADDocument> documents, RasterImageFormat imageFormat) 
{ DocumentConverter converter = new DocumentConverter(); foreach (LEADDocument document in documents) { string name = string.IsNullOrEmpty(document.Name) ? "DocumentAttachment" : document.Name; string outputFile = Path.Combine(OutputDir, $"{name}.{RasterCodecs.GetExtension(imageFormat)}"); int count = 1; while (File.Exists(outputFile)) outputFile = Path.Combine(OutputDir, $"{name}({count++}).{RasterCodecs.GetExtension(imageFormat)}"); DocumentConverterJobData jobData = new DocumentConverterJobData { Document = document, Cache = cache, DocumentFormat = DocumentFormat.User, RasterImageFormat = imageFormat, RasterImageBitsPerPixel = 0, OutputDocumentFileName = outputFile, }; DocumentConverterJob job = converter.Jobs.CreateJob(jobData); converter.Jobs.RunJob(job); if (job.Errors.Count > 0) foreach (var error in job.Errors) Console.WriteLine($"Error during conversion: {error.Error.Message}\n"); else Console.WriteLine($"Successfully Converted to {outputFile}...\n"); } 
} 

運(yùn)行項(xiàng)目

按F5或選擇Debug -> Start Debugging運(yùn)行項(xiàng)目。

如果正確執(zhí)行了這些步驟,應(yīng)用程序?qū)⑦\(yùn)行并將給定 PDF 文件中的所有附件轉(zhuǎn)換為單獨(dú)的 PNG 文件。

以上便是從 PDF 中提取附件 - 控制臺(tái) C#,如果您還有其他疑問,歡迎咨詢我們或者加入我們官方技術(shù)交流群。

http://www.risenshineclean.com/news/43458.html

相關(guān)文章:

  • 長沙企業(yè)100強(qiáng)名單福建seo關(guān)鍵詞優(yōu)化外包
  • 玉器哪家網(wǎng)站做的好個(gè)人網(wǎng)站備案
  • 順德專業(yè)網(wǎng)站制作友情鏈接分析
  • 一元注冊(cè)公司流程汕頭最好的seo外包
  • 昆明網(wǎng)站制作網(wǎng)頁環(huán)球軍事新聞最新消息
  • 網(wǎng)站建設(shè)需求調(diào)研計(jì)劃表網(wǎng)絡(luò)推廣的方法和技巧
  • 義烏網(wǎng)站優(yōu)化福建seo學(xué)校
  • 網(wǎng)站做提示框今日新聞50字
  • 域名鏈接網(wǎng)站網(wǎng)絡(luò)推廣都是收費(fèi)
  • 網(wǎng)站推廣文案谷歌商店下載
  • 網(wǎng)站設(shè)計(jì)建設(shè)公司seo原創(chuàng)工具
  • 沈陽男科醫(yī)院哪家好醫(yī)關(guān)于進(jìn)一步優(yōu)化 廣州
  • 廣州網(wǎng)站制作系統(tǒng)優(yōu)化seo方法
  • 有免費(fèi)做網(wǎng)站的嗎北京網(wǎng)站優(yōu)化seo
  • 網(wǎng)站備案屬于公司哪一塊能讓手機(jī)流暢到爆的軟件
  • 鄭州網(wǎng)站開發(fā)與建設(shè)長沙網(wǎng)站優(yōu)化seo
  • 網(wǎng)站的banner輪播怎么做網(wǎng)站秒收錄
  • 公司網(wǎng)站的建設(shè)要注意什么臨沂百度推廣的電話
  • 百度驗(yàn)證網(wǎng)站seo優(yōu)化神器
  • 廣東新聞聯(lián)播吳姍姍seo服務(wù)深圳
  • 手機(jī)網(wǎng)站開發(fā)用什么語言百度不讓訪問危險(xiǎn)網(wǎng)站怎么辦
  • 婚戀網(wǎng)站翻譯可以做嗎中國數(shù)據(jù)統(tǒng)計(jì)網(wǎng)站
  • 通化網(wǎng)站制作濟(jì)南特大最新消息
  • 邵陽市城鄉(xiāng)建設(shè)廳網(wǎng)站一鍵清理加速
  • 自己怎么做企業(yè)網(wǎng)站建設(shè)上海短視頻seo優(yōu)化網(wǎng)站
  • 燈光設(shè)計(jì)網(wǎng)站推薦軟件開發(fā)培訓(xùn)中心
  • wordpress調(diào)整上傳文件深圳seo優(yōu)化seo優(yōu)化
  • 怎么學(xué)做淘寶免費(fèi)視頻網(wǎng)站湖南好搜公司seo
  • 蘇州建站免費(fèi)模板成都seo技術(shù)經(jīng)理
  • c語言在線編程網(wǎng)站優(yōu)化設(shè)計(jì)三年級(jí)下冊(cè)數(shù)學(xué)答案