如何使用c#编程优化pdf。 [英] how to optimize pdf using c# programming.
本文介绍了如何使用c#编程优化pdf。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在为第三方图书馆进行优化,这意味着对PDF进行折扣。
不是第三方应用,它应该是一个可以在C#代码中使用的DLL来优化(线性化)pdf。
我知道PDFTRON和BYTECOUNT但它的成本更高。
如果有人知道其价格较低的话。
任何使用c#和iTextSharp的想法都可以压缩pdf
提前谢谢
Hi all,
I am serching for Third party library for optimize means linerarize PDF.
not 3rd party application, it should be a DLL which can be used in C# code to optimize(linearize) pdf.
I know PDFTRON and BYTECOUNT but it costs more.
If anybody Knows lesser in price its gud.
Any idea using c# and iTextSharp can we compress pdf
Thanks in advance
推荐答案
使用iTextSharp是可能的,你需要设置PDF的版本,然后试试这个
Using iTextSharp is possible you need to set the version of PDF and then, try this
Document doc = new Document(PageSize.A4, 50, 50, 25, 25);
PdfWriter writer = PdfWriter.GetInstance(doc, ms);
PdfContentByte contentPlacer;
writer.SetPdfVersion(PdfWriter.PDF_VERSION_1_5);
writer.CompressionLevel = PdfStream.BEST_COMPRESSION;
即使我这样阅读但不确定它是否会起作用,我有一个试过。看看哪一个有帮助你
Even i read this way but not sure it will work, above one i have tried. See which one helps u
string pdfFile = @"D:\Test.pdf";
PdfReader reader = new PdfReader(pdfFile);
PdfStamper stamper = new PdfStamper(reader, new FileStream(@"D:\Test1.pdf", FileMode.Create), PdfWriter.VERSION_1_5);
stamper.FormFlattening = true;
stamper.SetFullCompression();
stamper.Close();
你检查 verypdf [ ^ ]
这篇关于如何使用c#编程优化pdf。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文