Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Reduce PDF size



  • I am using printToPDF to create PDFs of a QWebEnginePage, but would like to compress the PDF file size. I have tried using QPrinter with a smaller page size, but I am unable to scale the webpage to fit into the selected page size. Any ideas on how best to achieve the objective would be much appreciated!



  • Hi @HappyAct

    I would try to scale the QPainter (using a world transform) by the factor between the size of the widget and the size of the page.rect.

    -Michael.


Log in to reply