views:

15

answers:

0

Hello everyone,

I'm currently trying to extract an image from a pdf file using iTextSharp.

The pdf is made from a scanner: it has a single page that contains one big image.

When looking at the file I find the following:

<< /Type /XObject /Subtype /Image /Name /Obj3 /Width 2480 /Height 3507 /ColorSpace /DeviceGray /BlackIs1  true /BitsPerComponent 1 /Length 5 0 R /Filter /CCITTFaxDecode /DecodeParms << /K -1 /Columns 2480 >> >> stream

I can access that using iTextSharp and I try to save it using the following code:

Dim aFromImageStream = New MemoryStream()
aFromImageStream.Write(bytes, 0, bytes.Length)
Dim anImage = System.Drawing.Bitmap.FromStream(aFromImageStream, True, True)
anImage.Save("c:\test.tiff", System.Drawing.Imaging.ImageFormat.Tiff)

But, that doesn't work as I get one big black tiff file with different shades of gray on top.

Does anyone know a way how I can decode those CCITTFaxDecode images?