Is it available the library QPrinter for Symbian? I just wanna use it to generate PDF files but when i try to compile, i have the following error:
C:\Users\JTorres\Documents\QtProjects\QML\QuotationMaker\pdfcreator.cpp:12: error: incomplete type 'QPrinter' used in nested name specifier
C:\Users\JTorres\Documents\QtProjects\QML\QuotationMaker\pdfcreator.cpp:12: error: invalid use of incomplete type 'struct QPrinter'
It seems that i didn't add the header <QPrinter>, but i do..
pdfCreator.h
pdfCreator.cppCode:#ifndef PDFCREATOR_H #define PDFCREATOR_H #include <QObject> #include <QTextDocument> #include <QPrinter> #include <QThread> class pdfCreator : public QObject { Q_OBJECT public: explicit pdfCreator(QObject *parent = 0); signals: void pdfGenerated(); public slots: void setHtml(QString str){m_html = str;} void setFileName(QString filename){m_filename = filename;} void createPDF(); private: QTextDocument *pdfGen; QPrinter *printer; QString m_html; QString m_filename; }; #endif // PDFCREATOR_H
Code:#include "pdfcreator.h" #include <QDebug> pdfCreator::pdfCreator(QObject *parent) : QObject(parent) { } void pdfCreator::createPDF() { this->pdfGen = new QTextDocument(); this->printer = new QPrinter(QPrinter::ScreenResolution); this->printer->setOutputFormat(QPrinter::PdfFormat); qDebug() << "createPDF!!!!!!"; this->pdfGen->clear(); this->pdfGen->setHtml(m_html); printer->setOutputFileName("tempfile.pdf"); this->pdfGen->print(printer); delete pdfGen; delete printer; emit pdfGenerated(); }

Reply With Quote

