PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

ExportImage throws on PDFv1.3 files
http://forum.pdfsharp.de/viewtopic.php?f=2&t=2348
Page 1 of 1

Author:  andy_t [ Sun Mar 03, 2013 5:49 pm ]
Post subject:  ExportImage throws on PDFv1.3 files

First, I'm new to PDFsharp, so sorry is this is in the wrong place. I did a broad search and didn't find anthing on this topic. I'm running the latest version of the code, downloaded 02Mar2013.

[Issue]: I have a PDFv1.3 file with embedded JPEG images. GetName() is throwing when it tries to parse /Filter key.(PDF header below) Any help would be greatly apprciated!

throw new InvalidCastException("GetName: Object is not a name.");

%PDF-1.3
% âãÏÓ
3 0 obj
<< /Type /XObject
/Subtype /Image
/Width 2144
/Height 2848
/BitsPerComponent 8
/Length 629552
/ColorSpace /DeviceRGB
/Filter [/FlateDecode /DCTDecode]
>>
stream

Author:  andy_t [ Mon Mar 04, 2013 3:32 am ]
Post subject:  Re: ExportImage throws on PDFv1.3 files

A refined search turned up this thread: viewtopic.php?f=2&t=1053&p=2814&hilit=%2FFilter+%5B%2FFlateDecode+%2FDCTDecode%5D#p2814

I guess the answer is: "Not supported...." Back to square one. :cry: It also apears that GetImage() doesn't handle /FlateDecode, so not sure what I'm going to do......

Author:  Thomas Hoevel [ Mon Mar 04, 2013 10:23 am ]
Post subject:  Re: ExportImage throws on PDFv1.3 files

andy_t wrote:
I guess the answer is: "Not supported...."
The answer is "left as an exercise to the reader". The sample is only meant to get you started.

With "/Filter [/FlateDecode /DCTDecode]" you only have to call the decoder for "/FlateDecode" to get the JPEG file.

See also:
viewtopic.php?p=5635#p5635

Author:  andy_t [ Tue Mar 05, 2013 9:35 pm ]
Post subject:  Re: ExportImage throws on PDFv1.3 files

Thanks Thomas.... We always want life to be simple. With the other thread you provided, and a bit of work on my part, I was able to isolate the internally compressed jpeg stream, decompress it, and save the image.

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