-
Notifications
You must be signed in to change notification settings - Fork 257
Are there compression options? #263
Unanswered
RevitArkitek
asked this question in
Q&A
I have a 3 page pdf. In my app I deleted the 3rd page. The file size went up 2 kb, I expected it to go down. ChatGPT says PDFsharp doesn't do compression. Is this true? Is there anything I can do or I need to look for a different option?
All reactions
Replies: 2 comments
For compression, you could try a combination of these options:
doc.Options.CompressContentStreams = true;
doc.Options.EnableCcittCompressionForBilevelImages = true;
doc.Options.FlateEncodeMode = PdfFlateEncodeMode.BestCompression;
doc.Options.UseFlateDecoderForJpegImages = PdfUseFlateDecoderForJpegImages.Always;
where doc is an instance of a PdfDocument.
Regarding the deletion of pages, see #141
All reactions
0 replies
Never trust the first answer from ChatGPT. Things are complicated.
PDFsharp supports compression, as packdat already pointed out. But PDFsharp does not support XREF streams, so files containing XREF streams will usually grow in size when being processed with PDFsharp.
So yes, sometimes files will grow in size even if you only remove a page.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment