How to print an existing PDF using Poppler (Qt5)?

Asked

Viewed 116 times

5

I’m using Poppler for Qt5, but I’ve reviewed the API documentation https://people.freedesktop.org/~aacid/Docs/Qt5/ to read existing PDF documents, I need to put the functionality to send to printer, but I have no idea where to start, the most I did was this (read the PDF):

QString filename = "c:/exemplos/meupdf.pdf";
Poppler::Document* document = Poppler::Document::load(filename);

And to print the existing PDF document, the only thing I could imagine I could do is copy the PDF to an image and print later:

QImage image = pdfPage->renderToImage(xres, yres, x, y, width, height);

But it really seems like a lot of work, I’d like to know, is there any way I can do it using Poppler::Document + QPrinter, or anything other than saving as an image?

  • I could find this: https://wiki.qt.io/Handling_PDF, I don’t know if it helps

  • @Denisrudneidesouza not this is different, this link you sent me is to generate PDF based on a print of something else, like a QImage or QTextDocument. My case is the opposite of this, I want to print an existing PDF.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.