I have some very large PDF files that are being created using C# and ItextSharp. One of the biggest files gets very close to the 10GB limit on file. iText will never compress an XMP metadata stream; all other content streams are compressed by default. You’ve already used the setCompressionLevel(). I want to compress a PDF file size from MB’s to KB’s (if the file size is 5 MB then it should be compressed in to KB’s like KB or KB).

Author: Tygobar Ker
Country: Guyana
Language: English (Spanish)
Genre: Love
Published (Last): 17 June 2006
Pages: 355
PDF File Size: 5.13 Mb
ePub File Size: 5.9 Mb
ISBN: 453-7-23369-946-8
Downloads: 29597
Price: Free* [*Free Regsitration Required]
Uploader: Tygojas

However you may be able to use System. Format “Original file size: Have you considered compressing the images prior to adding them to the PDF?


You will use the SetFullCompression method of the PdfWriter class to use the full compression option. It still works but it is very close to the upper limit. Submit a new link.

Possibly a super simple document might get larger with this enabled, not sure and don’t feel like testing. You want to reduce the quality of the contained images so that the final size will be much smaller? Free Support If you have compreession technical question, and want an answer for free, you can post questions to: SetMargins 0, 0, 0, 0 ; iTextSharp.

Compression of stream objects mainly images could help you to decrease overall PDF size.

Treat my content as plain text, not as HTML. Log in or sign up in seconds. PDFs created from a itxtsharp etc. This property is actually part of the PdfStream class which many classes ultimately derive from. In iText you got several options: No job postings For Hire and Hiring Rule 2: Has its compression effect not been good enough? Submitted links to be made with effort and quality Read more here.


PDF and compression (iText 5)

Do you have a question? In the resulting PDF file, content streams will be compressed, but so will some other objects, such as the cross-reference table. See above I owe you one. So these two calls actually do the same thing. Just do some searches for iTextSharp and image compression there should be several internal solutions out there.

PdfStamperImp is derived from PdfWriter iteextsharp when you use stamper. By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies.

This can be handy when you need to compgession a PDF document. It works really good for me. I’m debating about chopping it into 5K page chunks, but was actually hoping I was just missing something, little frazzled after 3 days of struggling on this! You should do one of these too. There’s actually a third parameter that you can pass to SetPageContent to set your specific compression level if you want.

Optimize(compress)PDF using C# and iTextSharp | The Forums

I mean if you want to reduce the size of your pdf we could also tell you to cut of pages until your pdf has the right size. Just because you tell iTextSharp to use compression when saving the PDF, it doesn’t mean it will reduce it very much if at all. This setting doesn’t “trickle down”, however. Insults are not welcome.

RemoveUnusedObjects ; will also com;ression you recent versions remove unused objects by default. This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: This forum is about visual studio IDE, as your issue is related to your visual basic code, it would be related to vb, I help you move this case to visual basic forum for dedicated support.


In iTextSharp, you can use the CompressionLevel property of the PdfWriter class to set the compression level of stream objects that are written to the FileStream. Sign up or log in Sign up using Google.

C# and itextsharp PDF compression – CodeProject

It is updated on a regular basis, depending on how many new questions appear on StackOverflow. Leonard, didn’t know at first what you meant with “refrying” but found this article compresison yours which explains it quite well: There is a great answer I read on stackoverflow from Chris Haas: Essentially, I have a list of folders that contain many PDF files ranging from 1MB to 10MB in size, and the quantity of these folders keeps growing every day, so to save disk space I would like to be able to read in itextshwrp PDF file once it has been processed, compress it, then save it to the designated folder location.

One option in listing Note that developers post answers on StackOverflow on a voluntary basis; there’s no guaranteed response-time and responding to this free forum has low priority compared to delivering commercial support. Not for VB6 questions. Decompressing can be done exactly the same way by setting the compression level to zero, or by using the following code.