static bool ExportImage(PdfDictionary image, ref int count) { bool ret = false; try { string filter = image.Elements.GetName("/Filter"); switch (filter) { case "/DCTDecode": ret = ExportJpegImage(image, ref count); break; /* case "/FlateDecode": * ExportAsPngImage(image, ref count); * break;*/ default: ret = true; break; } } catch (Exception)//in case its an object array so we need first to decompress it { byte[] stream = image.Stream.Value; PdfSharp.Pdf.Filters.FlateDecode aug = new PdfSharp.Pdf.Filters.FlateDecode(); stream = aug.Decode(stream); ret = ExportJpegImage(stream, ref count); } return(ret); }
static bool ExportImage(PdfDictionary image, ref int count) { bool ret = false; try { string filter = image.Elements.GetName("/Filter"); switch (filter) { case "/DCTDecode": ret = ExportJpegImage(image, ref count); break; /* case "/FlateDecode": ExportAsPngImage(image, ref count); break;*/ default: ret = true; break; } } catch (Exception)//in case its an object array so we need first to decompress it { byte[] stream = image.Stream.Value; PdfSharp.Pdf.Filters.FlateDecode aug = new PdfSharp.Pdf.Filters.FlateDecode(); stream = aug.Decode(stream); ret = ExportJpegImage(stream, ref count); } return ret; }