PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Wed Dec 03, 2025 5:38 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu May 17, 2012 8:47 am 
Offline

Joined: Thu May 17, 2012 8:38 am
Posts: 2
static void ExportAsPngImage(PdfDictionary image, ref int count)
{
int width = image.Elements.GetInteger(PdfImage.Keys.Width);
int height = image.Elements.GetInteger(PdfImage.Keys.Height);
int bitsPerComponent = image.Elements.GetInteger(PdfImage.Keys.BitsPerComponent);

// TODO: You can put the code here that converts vom PDF internal image format to a Windows bitmap
// and use GDI+ to save it in PNG format.
// It is the work of a day or two for the most important formats. Take a look at the file
// PdfSharp.Pdf.Advanced/PdfImage.cs to see how we create the PDF image formats.
// We don't need that feature at the moment and therefore will not implement it.
// If you write the code for exporting images I would be pleased to publish it in a future release
// of PDFsharp.
}

(1) Does someone write the code for exporting png image?

(2) When export image, "/DCTDecode" and "/FlateDecode" are used. Are they used to differentiate image type? And how are they written into PDF?

switch (filter)
{
case "/DCTDecode":
ExportJpegImage(image, ref count);
break;

case "/FlateDecode":
ExportAsPngImage(image, ref count);
break;
}

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Thu May 17, 2012 5:16 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 355
wmj wrote:
And how are they written into PDF?
The code that adds them to the PDF is included with PDFsharp. And all details are in Adobe's PDF reference.

/DCTDecode indicates JPEG images
/FlateDecode indicate LZW compressed data => with /DCTDecode: "zipped" JPEG, without /DCTDecode: "zipped" PDF bitmap

See also:
http://stackoverflow.com/q/10024908/1015447
viewtopic.php?f=2&t=1944&hilit=%2FFlateDecode
viewtopic.php?f=2&t=1053&hilit=%2FFlateDecode

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Fri May 18, 2012 4:41 am 
Offline

Joined: Thu May 17, 2012 8:38 am
Posts: 2
() => true wrote:
wmj wrote:
And how are they written into PDF?
The code that adds them to the PDF is included with PDFsharp. And all details are in Adobe's PDF reference.

/DCTDecode indicates JPEG images
/FlateDecode indicate LZW compressed data => with /DCTDecode: "zipped" JPEG, without /DCTDecode: "zipped" PDF bitmap

Thanks.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 178 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