title: PDFSharp compress filesize in c#
body: <p>In my App i generate an PDF-File with PDFSharp.Xamarin which I got from this site:
  <a href="https://github.com/roceh/PdfSharp.Xamarin" rel="nofollow noreferrer">https://github.com/roceh/PdfSharp.Xamarin</a></p>
  
  <p>Everything is working fine.
  In my PDF-Document I have many Images, which are compressed.
  But the file size of my PDF-Document is too large.</p>
  
  <p>Is there a possibility to compress my PDF-Document before saving it?</p>
  
  <p>How can I work with the PdfSharp.SharpZipLib.Zip Namespace to deflate the file size?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Here is my Code:</p>
  
  <pre><code>document = new PdfDocument();
  document.Info.Title = nameDok.Replace(" ", "");
  document.Info.Author = "---";
  document.Info.CreationDate = DateTime.Now;
  document.Info.Subject = nameDok.Replace(" ", "");
  
  //That is how i add Images:
  XImage image = XImage.FromStream(lstr);
  gfx.DrawImage(image, 465, YPrev - 2, newimagewf, newimagehf);
  
  document.CustomValues.CompressionMode = PdfCustomValueCompressionMode.Compressed;
  document.Options.FlateEncodeMode = PdfFlateEncodeMode.BestCompression;
  
  document.Save(speicherPfad);
  </code></pre>
  
  <p>Thanks for everyone.</p>