PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Dec 08, 2019 11:35 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: pdf compression
PostPosted: Mon Nov 11, 2019 3:44 pm 
Offline

Joined: Sun Nov 03, 2019 7:51 pm
Posts: 37
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


Top
 Profile  
Reply with quote  
 Post subject: Re: pdf compression
PostPosted: Tue Nov 12, 2019 9:45 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3012
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: pdf compression
PostPosted: Tue Nov 12, 2019 7:37 pm 
Offline

Joined: Sun Nov 03, 2019 7:51 pm
Posts: 37
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: pdf compression
PostPosted: Tue Nov 12, 2019 10:08 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 508
Location: CCAA
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.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group