Embedded Images and ExportAsTiff(FilterWriter)

Ryan,

This worked perfectly, thank you. However I ran into problem number 2. This does not work with InlineImages. I found this link: https://www.pdftron.com/documentation/samples/dotnetcore/cs/ElementReaderAdvTest so I was able to turn the Inline Image into a byte array, which seems to look like what I am expecting, but when I try to load that byte array into a standard Windows GDI Bitmap I am getting errors. Do I need to do anything else to the array in order for it to become a Bitmap object in C#?

I saw in the above link there is a section of code which makes it appear an Element can turn into a bitmap, however I was unable to find this function/method in the actual intellisense API when using the SDK:

// System.Drawing.Bitmap bmp = image.GetBitmap(); // bmp.Save(output_path + “reader_img_extract_” + image_counter.ToString() + “.png”, System.Drawing.Imaging.ImageFormat.Png);

Could you provide the input PDF file, and the code you tried.

I saw in the above link there is a section of code which makes it appear an Element can turn into a bitmap, however I was unable to find this function/method in the actual intellisense API when using the SDK:
https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.Image.html#pdftron_PDF_Image_GetBitmap

https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.Image.html#pdftron_PDF_Image_GetBitmap

Message from poster (attached file has been omitted)

I am happy to replace the code with anything, all I care about is ending up with a System.Drawing.Bitmap or png or tiff or anything I can load and view as an image.

Image2RGBA img_conv = new Image2RGBA(element, true);
FilterReader fr = new FilterReader(img_conv);
byte[] buff = new byte[img_conv.Size()];
fr.Read(buff);
imageStrings.Add(System.Convert.ToBase64String(buff)); //You can ignore this for the most part. I am just getting a Base64 string to send it to another function
fr.Dispose();
img_conv.Dispose();

I also looked at this code: https://www.pdftron.com/documentation/samples/dotnetcore/cs/ElementReaderAdvTest and tried to do the image.GetBitmap() line but the system does not recognize .GetBitmap.

PDF is also attached (omitted)

I processed the PDF you provided, and all the inline images came out as expected.

Attached is the code I used.

If that doesn’t work, then please provide full details of exactly what didn’t work and how exactly you expected it to work.

ImageExtractTest.cs (5.12 KB)