Click here to Skip to main content
15,917,928 members
Please Sign up or sign in to vote.
1.24/5 (3 votes)
See more:
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
Posted
Updated 7-Sep-11 23:36pm
v3

Using iTextSharp is possible you need to set the version of PDF and then, try this

C#
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;
 
Share this answer
 
Comments
Akshaya Dash 8-Sep-11 5:47am    
thanks 4 ur post,i already tried this before not working.
Anuja Pawar Indore 8-Sep-11 5:54am    
See a similar thread, if that can help u

http://www.codeproject.com/Answers/245052/How-to-optimize-compress-pdf-using-csharp-and-iTex.aspx#answer2
Akshaya Dash 8-Sep-11 6:02am    
Thanks,

this thread also i raised...
laxman singh negi 16-Aug-12 7:05am    
In which version of itextsharp exist below properties.

writer.CompressionLevel = PdfStream.BEST_COMPRESSION;

thanks
laxman
Anuja Pawar Indore 16-Aug-12 8:14am    
Even i read this way but not sure it will work, above one i have tried. See which one helps u

C#
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();
 
Share this answer
 
Comments
Anuja Pawar Indore 8-Sep-11 5:56am    
Please read this too, hope it helps you

http://itextpdf.com/examples/iia.php?id=218
have u check verypdf[^]
 
Share this answer
 
Comments
Akshaya Dash 7-Sep-11 3:27am    
My dear, i dont want tool, i want library file(dll).
that can use in my code to compress pdf.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900