PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 5:05 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jan 13, 2016 9:48 am 
Offline

Joined: Wed Jan 13, 2016 9:33 am
Posts: 15
an options that allow to either create smaller PDF files or to speed up PDF creation.

How I may active this features ?

Thank you in advance


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 13, 2016 10:00 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
http://www.pdfsharp.net/Preview_Information.ashx

Quote:
The Options property of PdfDocument now has new options that allow you to speed up the PDF generation (at the expense of larger files) or to create smaller PDF files (at the expense of longer running time).


See "FlateEncodeMode":
Quote:
Gets or sets the flate encode mode. Besides the balanced default mode you can set modes for best compression (slower) or best speed (larger files).


See "UseFlateDecoderForJpegImages":
Quote:
Gets or sets a value indicating whether to compress JPEG images with the FlateDecode filter.


See "EnableCcittCompressionForBilevelImages":
Quote:
Gets or sets a value indicating whether to compress bilevel images using CCITT compression.
With true, PDFsharp will try FlateDecode CCITT and will use the smallest one or a combination of both.
With false, PDFsharp will always use FlateDecode only - files may be a few bytes larger, but file creation is faster.


See "CompressContentStreams":
Quote:
Gets or sets a value indicating whether to compress content streams of PDF pages.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 13, 2016 10:41 am 
Offline

Joined: Wed Jan 13, 2016 9:33 am
Posts: 15
Is it correct for small size options ?

(C++/CLI, my pain ...)
m_pDocument = gcnew PdfDocument();

m_pDocument->Options->UseFlateDecoderForJpegImages = PdfUseFlateDecoderForJpegImages::Automatic;
m_pDocument->Options->FlateEncodeMode = PdfFlateEncodeMode::BestCompression;
m_pDocument->Options->EnableCcittCompressionForBilevelImages = true;
m_pDocument->Options->CompressContentStreams = true;
m_pDocument->Options->NoCompression = false;


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 13, 2016 10:59 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
I think these are the settings for smallest files.
And if you reference the PDFsharp source code in your solution: always use a RELEASE build when size matters, the DEBUG build creates larger files.
NuGet packages use the RELEASE build.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 13, 2016 11:13 am 
Offline

Joined: Wed Jan 13, 2016 9:33 am
Posts: 15
Thank you very much

Yes, I use release build of PdfSharp-gdi version (Windows target)

I rebuid it because I need remove "sealed" from XFont class, to add Orientation angle attribute
(I have some vertical text to render, angle equal to 90 and 270)

public ref class XFontEx : public PdfSharp::Drawing::XFont
{
public:
int Orientation;

XFontEx(System::Drawing::Font^ font, XPdfFontOptions^ pdfOptions)
: XFont (font, pdfOptions)
{
Orientation = 0;
}

XFontEx(String^ familyName, double emSize, XFontStyle style, XPdfFontOptions^ pdfOptions)
: XFont(familyName, emSize, style, pdfOptions)
{
Orientation = 0;
}

};


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 349 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