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: Kazirg Arashijin
Country: Republic of Macedonia
Language: English (Spanish)
Genre: Personal Growth
Published (Last): 13 September 2018
Pages: 58
PDF File Size: 10.46 Mb
ePub File Size: 9.47 Mb
ISBN: 569-3-84733-165-7
Downloads: 83586
Price: Free* [*Free Regsitration Required]
Uploader: Shaktilar

C# and ItextSharp PDF compression : csharp

I just “sent” a. But then you would have to decompress or unzip it to display it in a. Additionally, the cross-reference table can be compressed and stored in a stream. PDF is mostly images then probably not much compression will occur since those will probably already be compressed images unless they are.

Believe it or not, it was in front of me the whole time, GhostScript to the rescue!

I’ll update when I have more data. What information in those PDFs is superfluous in your context and can be thrown away? Itextharp Bruno Lowagie, this is a very concise response. Please Sign up or sign in to vote. I’ve been on this for 3 days now, and frankly have run out of ideas. Not for VB6 questions.

C# and itextsharp PDF compression

Or you want to enforce access permissions to the people who download the PDF; for instance, they can view it, but they are not allowed to print it. Just do some searches for iTextSharp and image compression there should be several internal solutions out there.


Dear Leonard Rosenthol, I didn’t try using Adobe Acrobat but i want to do through utextsharp not manually why because that is not a fixed size it may vary and the files should be uploaded by users. You need to be certain that there are unused things in your pdf.

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. ITextSharp allows you to navigate over PDF pages and edit objects inside it along with many other features.

In the past I’ve used Docotic. Below is the code for anyone who may ever need it. Appreciate the insight though. Articles Quick Answers Messages Use my saved content filters. As a workaround, you can use the getPageContent method to get the content stream of a page, and the setPageContent method to put it back. I’m thinking of getting the commercial licensed 5.

Thank you for your understanding.

I am guessing you want to reduce the size of Pdfs which mostly or only contain images e. To get an idea whats possible try the following two options in adobe itextshapr There’s actually no requirement that what we think of as “compression” actually occurs but in reality I think it would always happen. So, since I can’t by everyone a beer, wish I could, but hey nothing in life is perfect, but instead here is the solution What are you using as source images, are they TIFF or some other format?


ChrisHaas True, but this can be dangerous. A minimal “Hello World” file could increase in file size when you use “full compression”.

Forums – C# Corner

This can be handy when you need to debug a PDF document. No malicious, intentionally harmful software Rule 3: Tuesday, July 8, at I work at a photobook internet company and we iitextsharp the print PDF’s using iText, but the output can be huge, like mb, so we use Ghostscript to compress the resulting file.

No job postings For Hire and Hiring Rule 2: You want to reduce the quality of the contained images so that the final size will be much smaller?

Pdf enterprise library, and it worked great. I looked at many of the free ones, such as PDFSharp, which is very good in my opinion at coompression PDFs, but cannot render or compress them. Sign up using Facebook.

C# tutorial: PDF compression

Let’s work to help developers, not make them feel stupid. Have you tried the suggestion from Chris’ answer? Treat my content as plain text, not as HTML. Nov 12, Leonard, didn’t know at first what you meant with “refrying” but found this article of yours which explains it quite well: When answering a question please: