-2

I want to read a .PDF file in Qt. I placed my .PDF file in the resource(qrc) folder.

How can i read the PDF file from there? I want to load a PDF file on the click of a button.

Ishu
  • 5,357
  • 4
  • 16
  • 17
Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64

1 Answers1

3

Read your pdf file via QFile, resource access is done by prepending the path in the resource with a ":".

Qt does not natively support displaying PDF documents (it can export them using QPrinter though). You can do it through third-party libraries such as Poppler, see this Qt Quarterly edition on how to do it.

FWIW the resource access information is the docs, and the PDF stuff I got off Google in 30 seconds. I expect a bit more research effort for someone with 7K+ rep points.

cmannett85
  • 21,725
  • 8
  • 76
  • 119