Hello,
I am trying to use the export image example to export images from a pdf.
The pdf was created with pdfsharp, basically it contains only jpeg images created with this code:
Code:
PdfPage page = document.AddPage();
page.Size = PageSize.A4;
XGraphics gfx = XGraphics.FromPdfPage(page);
using (XImage image = XImage.FromFile(imageFile))
{
gfx.DrawImage(image, 0, 0, page.Width, page.Height);
}
When I run the code sample I get an exception in this method:
Code:
static void ExportImage(PdfDictionary image, ref int count)
{
string filter = image.Elements.GetName("/Filter");
switch (filter)
{
case "/DCTDecode":
ExportJpegImage(image, ref count);
break;
/*case "/FlateDecode":
ExportAsPngImage(image, ref count);
break;*/
}
}
when it tries to read the filter it says object is not a string.
Any advice?
Thank you