wxPdfDocument to image is it possible?

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
User avatar
cutecode
I live to help wx-kind
I live to help wx-kind
Posts: 175
Joined: Fri Dec 09, 2016 7:28 am
Contact:

wxPdfDocument to image is it possible?

Postby cutecode » Mon May 14, 2018 8:10 pm

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...?
regards,
Alexander Saprykin
www.wxwidgets.ru

utelle
Moderator
Moderator
Posts: 812
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPdfDocument to image is it possible?

Postby utelle » Mon May 14, 2018 9:12 pm

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

User avatar
cutecode
I live to help wx-kind
I live to help wx-kind
Posts: 175
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: wxPdfDocument to image is it possible?

Postby cutecode » Tue May 15, 2018 8:07 am

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?
regards,
Alexander Saprykin
www.wxwidgets.ru

utelle
Moderator
Moderator
Posts: 812
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPdfDocument to image is it possible?

Postby utelle » Tue May 15, 2018 12:32 pm

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

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1619
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxPdfDocument to image is it possible?

Postby PB » Tue May 15, 2018 2:32 pm

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?


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 0 guests