Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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 size. It still works but it is very close to the upper limit. When I take the file and open it in Acrobat X, I can get the compression down to just over 5GB.

iTextSharp never seems to get this close no matter what settings I apply via the codebase.

This is some stub code that I copied, it shows the settings I am using for the beginning of the PDF creation process. I've been on this for 3 days now, and frankly have run out of ideas. Thanks in advance for any advice!

What I have tried:

lPDF = new iTextSharp.text.Document(lPageSize, 0, 0, 0, 0);
lPDF.SetPageSize(iTextSharp.text.PageSize.LEGAL);
lPDF.SetMargins(0, 0, 0, 0);

iTextSharp.text.pdf.PdfWriter lPDFwriter = iTextSharp.text.pdf.PdfWriter.GetInstance(lPDF, new System.IO.FileStream(lOutputDirectory + "\\" + lOutputFilename, System.IO.FileMode.Create));
lPDFwriter.ViewerPreferences = PdfWriter.PageModeUseOutlines;

lPDFwriter.PdfVersion = PdfWriter.VERSION_1_6;
lPDFwriter.SetFullCompression();
lPDF.Open();
Posted

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