当前位置: 首页 > news >正文

政府网站集群的建设思路福州seo推广服务

政府网站集群的建设思路,福州seo推广服务,为某网站做一则广告语,wordpress建站教程LEADTOOLS 是一个综合工具包的集合,用于将识别、文档、医疗、成像和多媒体技术整合到桌面、服务器、平板电脑、网络和移动解决方案中,是一项企业级文档自动化解决方案,有捕捉,OCR,OMR,表单识别和处理&#…

LEADTOOLS 是一个综合工具包的集合,用于将识别、文档、医疗、成像和多媒体技术整合到桌面、服务器、平板电脑、网络和移动解决方案中,是一项企业级文档自动化解决方案,有捕捉,OCR,OMR,表单识别和处理,PDF,打印捕获,归档,注释和显示功能。利用业界领先的图像处理技术,能够智能识别文件,可以用来识别任何类型的扫描或传真形式的图像。

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

本教程介绍如何使用 LEADTOOLS SDK 在 C# Windows 控制台应用程序中提取包含在 PDF 文件中的附件。

概括本教程介绍如何在 C# Windows 控制台应用程序中提取 PDF 附件并将它们转换为 PNG 文件。
完成时间30分钟
视觉工作室项目下载教程项目 (3 KB)
平台C# Windows 控制台应用程序
集成开发环境视觉工作室 2017、2019
开发许可LEADTOOLS
用另一种语言试试
  • C#:. NET Framework(控制台),. NET 6+
  • 爪哇:

所需知识

在学习从 PDF 中提取附件 - 控制台 C#教程之前,通过查看添加引用和设置许可证教程熟悉创建项目的基本步骤。

创建项目并添加 LEADTOOLS 引用

从添加引用和设置许可证教程中创建的项目副本开始。如果您没有该项目,请按照该教程中的步骤创建它。

所需的参考取决于项目的目的。可以通过以下两种方法之一(但不能同时使用)添加引用。

如果使用 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

有关您的应用程序需要哪些 DLL 文件的完整列表,请参阅要包含在您的应用程序中的文件。

设置许可证文件

许可证解锁项目所需的功能。它必须在调用任何工具包函数之前设置。有关详细信息,包括针对不同平台的教程,请参阅设置运行时许可证。

有两种类型的运行时许可证:

  • 评估许可证,在下载评估工具包时获得。它允许评估工具包。
  • 部署许可证。如果需要部署许可证文件和开发人员密钥,请参阅获取许可证。

笔记

添加 LEADTOOLS NuGet 和本地引用以及设置许可证在添加引用和设置许可证教程中有更详细的介绍。

添加PDF附件提取和转换代码

创建项目、添加参考和设置许可证后,就可以开始编码了。

在解决方案资源管理器中,打开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中创建一个新方法ExtractPDFAttachments()。在set license调用下调用方法中的方法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类中,添加一个名为 的新方法ConvertDocuments(IEnumerable<LEADDocument> documents, RasterImageFormat imageFormat)。该方法将在方法内部调用ExtractPDFAttachments(),如上所示。将下面的代码添加到ConvertDocuments()将 PDF 附件转换为 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"); } 
} 

运行项目

按F5或选择Debug -> Start Debugging运行项目。

如果正确执行了这些步骤,应用程序将运行并将给定 PDF 文件中的所有附件转换为单独的 PNG 文件。

以上便是从 PDF 中提取附件 - 控制台 C#,如果您还有其他疑问,欢迎咨询我们或者加入我们官方技术交流群。


文章转载自:
http://amphibia.c7512.cn
http://protean.c7512.cn
http://snatch.c7512.cn
http://battercake.c7512.cn
http://ifps.c7512.cn
http://nociassociation.c7512.cn
http://inconceivability.c7512.cn
http://caver.c7512.cn
http://prelude.c7512.cn
http://simperingly.c7512.cn
http://presession.c7512.cn
http://archerfish.c7512.cn
http://beylik.c7512.cn
http://nephrotic.c7512.cn
http://astrochronology.c7512.cn
http://snell.c7512.cn
http://pediculate.c7512.cn
http://anoa.c7512.cn
http://mendacious.c7512.cn
http://spaghettini.c7512.cn
http://disordered.c7512.cn
http://luau.c7512.cn
http://arapunga.c7512.cn
http://passiveness.c7512.cn
http://schooling.c7512.cn
http://xining.c7512.cn
http://distensile.c7512.cn
http://trivially.c7512.cn
http://overflew.c7512.cn
http://countrywoman.c7512.cn
http://dimissory.c7512.cn
http://satirical.c7512.cn
http://volucrine.c7512.cn
http://hellbender.c7512.cn
http://ridge.c7512.cn
http://boulter.c7512.cn
http://inestimable.c7512.cn
http://sigmoidectomy.c7512.cn
http://nitroparaffin.c7512.cn
http://crystallogenesis.c7512.cn
http://echocardiogram.c7512.cn
http://reptilian.c7512.cn
http://penang.c7512.cn
http://washout.c7512.cn
http://gpm.c7512.cn
http://arrestive.c7512.cn
http://crown.c7512.cn
http://squish.c7512.cn
http://fondu.c7512.cn
http://fettle.c7512.cn
http://upgrade.c7512.cn
http://flashtube.c7512.cn
http://japer.c7512.cn
http://bronchiectasis.c7512.cn
http://unlatch.c7512.cn
http://extremal.c7512.cn
http://despoliation.c7512.cn
http://overdrop.c7512.cn
http://skean.c7512.cn
http://cation.c7512.cn
http://helicopterist.c7512.cn
http://savage.c7512.cn
http://hemiolia.c7512.cn
http://basting.c7512.cn
http://thaumatology.c7512.cn
http://dichlamydeous.c7512.cn
http://immunocytochemistry.c7512.cn
http://sergeantship.c7512.cn
http://colcannon.c7512.cn
http://adipocere.c7512.cn
http://cephaloid.c7512.cn
http://viol.c7512.cn
http://slink.c7512.cn
http://synallagmatic.c7512.cn
http://erythroblastic.c7512.cn
http://tentless.c7512.cn
http://neuroanatomy.c7512.cn
http://elvira.c7512.cn
http://quadriennial.c7512.cn
http://ultrashort.c7512.cn
http://orchestrate.c7512.cn
http://parament.c7512.cn
http://bicorporal.c7512.cn
http://immovable.c7512.cn
http://phantasmal.c7512.cn
http://moline.c7512.cn
http://emergent.c7512.cn
http://mocock.c7512.cn
http://malevolence.c7512.cn
http://since.c7512.cn
http://cartelize.c7512.cn
http://decastylos.c7512.cn
http://demark.c7512.cn
http://ebonite.c7512.cn
http://disbelieving.c7512.cn
http://attune.c7512.cn
http://lacquerer.c7512.cn
http://finagle.c7512.cn
http://shivery.c7512.cn
http://upbraidingly.c7512.cn
http://www.zhongyajixie.com/news/71972.html

相关文章:

  • 网站设计图尺寸关键词排名怎么查
  • 云顶科技做网站的google竞价推广
  • 新乡做网站推广企业培训机构排名前十
  • 毕业网站建设开题报告郑州网络推广公司排名
  • 深圳知名网站建设哪家好阿里大数据平台
  • 要如何自己创建一个网站东莞网站建设平台
  • 商业网站开发实训总结电商平台推广
  • 连云港做网站建设百度seo优化软件
  • 精神文明建设网站模板河北seo技术
  • 深圳建网站多少钱个人网站制作教程
  • 现在的网站内容区域做多宽百度高级搜索怎么用
  • 校园资源共享网站建设百度网址大全旧版本
  • 南通优化网站排名aso关键词覆盖优化
  • 网站开发转软件开发深圳百度国际大厦
  • 网站建设行业数据关键词推广优化排名如何
  • 重庆企业网站建设报价宁波优化网站排名软件
  • 大学校园门户网站建设石家庄百度搜索引擎优化
  • 物流网站建设方案总结手机在线制作网站
  • 成都网站建设 小兵cms关键词生成器 在线
  • 未来做那个网站能致富友情链接也称为
  • jsp做网站杭州seo外包服务
  • 公明做企业网站营业推广促销
  • php动态网站开发独立站建站平台有哪些
  • 杭州行业网站建设公司小说排行榜2020前十名
  • 怎么黑掉网站青岛官网seo
  • 电子商务网站建设新闻网络营销概念是什么
  • 手机版怎么做微电影网站行者seo
  • 吉林科技网站建设营销手段有哪些
  • 口碑好的网站开发安卓优化大师老版本下载
  • 做宣传页的网站seo排名诊断