Also, how do I get from the return Image object class back to a UIImage that I can use on iOS, the casting I do above is probably incorrect
A:
You are getting Nil because the PDF does not appear to contain a thumbnail for the page. A PDF document may contain a thumbnail for a page, which if it exists, is what GetThumb returns. The call does not create a thumbnail. If you wish to generate a thumbnail, your best bet would be to use an instance of PDFDraw to rasterize the page at a small resolution.
Finally, yes the cast is incorrect, GetThumb returns an Obj*, not an NSObject*. You could use the Obj* that it returns to create a new Image (a PDFNet type), read out the pixel data from the Image and use the raw pixel data to create a new UIImage. Let me know if you would like some example code on how to do this.
you can also extract data without writing to disk using thumb.GetImageData() for example:
int w = thumb.GetImageWidth();
int h = thumb.GetImageHeight();
int out_data_sz = wh3;
Filters::FilterReader reader(thumb.GetImageData());
std::vector image_data_out(out_data_sz);
reader.Read(&image_data_out[0], out_data_sz);
void* buffer = &image_data_out[0];
assuming the thumbnail image is stored in 8-bpc RGB format.
Please keep in mind that most PDF files do not store thumbnail and that in this case ‘page.GetThumb()’ will return NULL obj.
You could pre-process your PDFs for fast vieweing on mobile devices (by embedding thumbnails, downsampling images, etc) as shown in the following article - https://groups.google.com/d/msg/pdfnet-sdk/PV_M_FvUfQ0/RJKZc9LzU1cJ
The upcoming version of PDFNet will also include a new method in PDFViewCtrl → GetThumbAsync() that could pick up embedded thumb (if available) or generate a dynamic thumb … however this major version will not be available for another month or so.
Sorry for not being specific enough but i was referring to he last sentence in the previous answer. I am able to retrieve thumbnail data in a matter similar to the one you described. My difficulties are in transforming that data into a UIImage instance.
Thank you so much for your in depth help and sorry for not clearing this out in the first place.
Sorry for not being specific enough but i was referring to he last sentence in the previous answer. I am able to retrieve thumbnail data in a matter similar to the one you described. My difficulties are in transforming that data into a UIImage instance.
Thank you so much for your in depth help and sorry for not clearing this out in the first place.