Create and write into a PDF File
I know this topic has been discussed a million times, but i dont understand why it isnt working for me.
I want to create and write into a PDF file, when i click on a button.
This is just one of many different approaches i tried.
The problem is, QT doesnt create any file.
Thanks in advance!
do you have
QT += printsupport
in your pro file?
Hi! Here's a working example.
Thanks for your answers.
I am not sure about the arguments in painter.drawText().
When i run the programm and press the button, QT says "QPainter::begin(): Returned false
Could you help me with that?
const QString filename("D://Programme/QT/MeineProjekte/Projekt/test.pdf");
QString testData = "test"; QPdfWriter pdfwriter(filename); pdfwriter.setPageSize(QPageSize(QPageSize::A4)); QPainter painter(&pdfwriter); painter.drawText(0,0, testData);
Hi, it seems to be 2 slashes after D:, maybe try
``const QString filename("`D:/Programme/QT/MeineProjekte/Projekt/test.pdf");```
This post is deleted!
Thanks a lot. It works now.