Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User gronerth's Avatar
    Join Date
    Oct 2010
    Posts
    4
    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
    Code:
    #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
    pdfCreator.cpp
    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();
    }

  2. #2
    Registered User gronerth's Avatar
    Join Date
    Oct 2010
    Posts
    4
    I have just seen in the Qt Documentation, that symbian doesn't support QPrinter...any other ideas how to generate a PDF file?

  3. #3
    Nokia Developer Champion rahulvala's Avatar
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,294
    Symbian OS does not support pdf files, but Adobe has written software by which it is operable in mobile.

  4. #4
    Registered User gronerth's Avatar
    Join Date
    Oct 2010
    Posts
    4
    Quote Originally Posted by rahulvala View Post
    Symbian OS does not support pdf files, but Adobe has written software by which it is operable in mobile.
    Thanks for the answer!, but i won't be useful in the app that I am writing because i was thinking to use QPrinter to generate a PDF file from a HTML string..

  5. #5
    Registered User boumacmilan's Avatar
    Join Date
    Sep 2011
    Posts
    11
    Plz, i have now the same probleme did you find any solution to solve it

  6. #6
    Registered User kamalakshan's Avatar
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998
    You will have to use a pdf library to generate pdf. Either you can license one or write your own.

  7. #7
    Registered User Johnny_B's Avatar
    Join Date
    Nov 2011
    Posts
    80
    I think it would be easier to send the html code to a server on the internet, render it to a PDF there and download it to the phone.

Similar Threads

  1. Import Vcard in symbian^3(Symbian c++)
    By shyam9 in forum Symbian C++
    Replies: 0
    Last Post: 2011-02-04, 09:55
  2. Replies: 2
    Last Post: 2010-10-21, 11:08
  3. diferences in symbian 7 n symbian 9
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2007-07-05, 14:31
  4. Replies: 1
    Last Post: 2007-04-27, 13:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved