如何使用C#和iTextSharp优化(压缩)pdf [英] How to optimize(compress) pdf using c# and iTextSharp

查看:612
本文介绍了如何使用C#和iTextSharp优化(压缩)pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有5个pdf,合并后变为2MB.因此,在通过我的应用程序打开pdf时,需要花费更长的时间.在acrobat中,有一个选项可以优化pdf,我也尝试过相同的方法.即优化后的2.5 mb pdf变为500kb.
我想在我的代码中执行的功能相同.我尝试使用iTextSharp SetFullCompression()方法,但无法正常工作.
我知道PDFTRON和BYTESCOUNT第三方DLL那里有4个,它花费更多(约1000美元)即我的客户不愿意购买.请分享一些知识,我该如何解决这个问题.我正在使用 iTextSharp 进行pdf生成和合并.

如果您知道任何价格较低的第三方dll,请进行更新.


预先感谢.

i have 5 pdfs, after merge it becomes 2MB. so while opening pdf through my application it takes longer time. in acrobat there is an option to optimize pdf i also tried same. i.e 2.5 mb pdf after optimize it becomes 500kb.
same functionality i want to do in my code.i tried with iTextSharp SetFullCompression()method but its not working.
i know PDFTRON and BYTESCOUNT third party dll there 4 this, it costs more(around 1000$)i.e. my client not willing to buy. please share some knowledge how i can i come out from this problem.i am using iTextSharp for pdf genaration and merge.

If u people know any third party dll with lesser price update the same.


Thanks in advance.

推荐答案

),即我的客户不愿意购买.请分享一些知识,我该如何解决这个问题.我正在使用 iTextSharp 进行pdf生成和合并.

如果您知道任何价格较低的第三方dll,请进行更新.


在此先感谢您.
)i.e. my client not willing to buy. please share some knowledge how i can i come out from this problem.i am using iTextSharp for pdf genaration and merge.

If u people know any third party dll with lesser price update the same.


Thanks in advance.


使用免费软件,有时您会得到所支付的...您是否试图获得他们自己的支持...还是可以查看iText的原始文档和支持因为移植的版本可能非常相似.

如果iTextSharp不支持该选项,则为您的客户提供2种选择:使用慢速应用程序或为更快的应用程序付费.

但是,如果可能的话,我建议您尝试使用其他产品.并对生成的PDF进行一些性能评估,然后您可以向客户展示如果他付费的话它可以得到什么.

但是,如果您只有一个客户并且他不愿意付款,那么您应该那样做.毕竟,您应该为自己的工作付钱……而这样一个库通常比几乎所有应用程序的总开发时间少得多.
With free software, sometime you get what you paid for... Have you tried to reach their own support... or maybe check for the original iText documentation and support as the ported version might be very similar.

If iTextSharp does not support that option, then give your client 2 choices: Live with slow application or pay for a something faster application.

However, I would recommand you to try alternate product if possible. And take some performance measure with generated PDF and then you can show you client what it can get if he pay for.

But if you have a single client and he is not willing to pay, then you should leave it that way. After all, you should be paid for what you do... and such a library would typically cost much less than total development time of any almost application.


除非您的客户端没有这样做付钱给您,使用第三者会比让您编码便宜得多.当您说优化"时,我从您的示例中得出的意思是您可能的大小最小,而加载时间却不是最快.
我有两种想法,您可能应该从这里开始.
1)应该是pdf线性化
2)应该压缩pdf(PdfWriter.CompressionLevel = PdfStream.BEST_COMPRESSION)

为了真正优化"您的PDF,您确实需要了解PDF格式
PDF参考和PDF规范的Adobe扩展 [
Unlesss your client doesn''t pay you, using 3rd party will be alot cheaper than having you code it. When you say optimize I take it from your example that you mean smallest possible size and not fastest possible load time.

Ihave two thinks you should probably start with.
1) The should be pdf Linearized
2) The pdf should be compressed (PdfWriter.CompressionLevel = PdfStream.BEST_COMPRESSION)

Inorder to really "optimize" your PDF, you really need to know the PDF format
PDF Reference and Adobe Extensions to the PDF Specification [^]
thus 3rd party maight be alot cheaper for your client.


这篇关于如何使用C#和iTextSharp优化(压缩)pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆