Page 1 of 1

wxPdfDocument to image is it possible?

Posted: Mon May 14, 2018 8:10 pm
by cutecode
I scoped to insert images to wxPdfDocument, and now I need to extract those images back from PDF file. Is it possible?
I looked at API docs and didn't find any function for it.
But may be someone knows...?

Re: wxPdfDocument to image is it possible?

Posted: Mon May 14, 2018 9:12 pm
by utelle
cutecode wrote:I scoped to insert images to wxPdfDocument, and now I need to extract those images back from PDF file. Is it possible?
I looked at API docs and didn't find any function for it.
There is no pre-defined function for this purpose. Keep in mind that wxPdfDocument is meant for generating PDF documents, not for editing and/or manipulating existing PDF files.

The class wxPdfParser has the building blocks to read an existing PDF file and to extract objects from it, but you have to know a lot about the PDF format and how to interpret it. That is, in principle it would be possible to extract images from a PDF file, but not out-of-the-box.

You would still have the problem to identify the images you need to extract. For this you might need to interpret the page content ... and wxPdfDocument has no support for this.

Conclusion: Not totally impossibe, but probably not easy to accomplish. Tools like PDFedit are most likely better suited for the purpose.

Regards,

Ulrich

Re: wxPdfDocument to image is it possible?

Posted: Tue May 15, 2018 8:07 am
by cutecode
Thank you very much for full answer.

Actually I need images of every page, not an individual image with precise coordinates.
What library would you recommend? Will wxPdfDC satisfy my needs?

Re: wxPdfDocument to image is it possible?

Posted: Tue May 15, 2018 12:32 pm
by utelle
cutecode wrote:Actually I need images of every page, not an individual image with precise coordinates.
What library would you recommend? Will wxPdfDC satisfy my needs?
No, wxPdfDC is just a wxWidgets drawing context, not able to manipulate existing PDF files at all.

Maybe you could use PDFedit for this purpose.

Regards,

Ulrich

Re: wxPdfDocument to image is it possible?

Posted: Tue May 15, 2018 2:32 pm
by PB
I have never used it but it seems PoDoFo can also manipulate PDFs; it seems a bit less dead and has more permissive licence than PDFEdit?