PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

pdf compression
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4053
Page 1 of 1

Author:  Jessica [ Mon Nov 11, 2019 3:44 pm ]
Post subject:  pdf compression

hi

i'm adding images to my pdf using migradoc, so it becomes big in file size.

Is there a way to set pdf compression at highest level?

if I do this, are images still good quality?

thx

Author:  Thomas Hoevel [ Tue Nov 12, 2019 9:45 am ]
Post subject:  Re: pdf compression

Jessica wrote:
if I do this, are images still good quality?
PDFsharp only applies lossless compression, so image quality does not change.
If files are too big it is up to you to shrink the images, thus you have full control over the image quality losses.

Author:  Jessica [ Tue Nov 12, 2019 7:37 pm ]
Post subject:  Re: pdf compression

Hi

I found some information about compression options in migradoc here: http://developer.th-soft.com/developer/ ... n-options/

The code used there is:

Code:
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);
pdfRenderer.PdfDocument = new PdfDocument();
pdfRenderer.PdfDocument.Options.FlateEncodeMode = PdfFlateEncodeMode.BestCompression;


"PdfDocument" is used, but in the code example of migradoc they are using "Document" as in following code line:

Code:
PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
renderer.Document = document;


What is the difference between "PdfDocument" and "Document" ?

If I use "Document" , can I still use the compression setting that's is applied to the "PdfDocument"?

I tried it, and my PDF file got a bit smaller.

Author:  TH-Soft [ Tue Nov 12, 2019 10:08 pm ]
Post subject:  Re: pdf compression

Jessica wrote:
What is the difference between "PdfDocument" and "Document"?
PdfDocument is the PDF document created by PDFsharp. Document is the MigraDoc document. The former is the output of PdfRenderer, the latter is the input.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/