Anybody who knows how to print local word and pdf files?QPrinter cann't do it.so any workground?




  • Moderators

    @TobyYi

    I took out the direct addressing of a moderator. He is certainly very skilled and willing to assist users with problems. On the hand it seems a bit rude to do this as you did. Please place simple posts and anybody understansing your issue may help you.

    For the actual problem, you need to describe a bit more what you are trying to do.

    Otherwise the most logical answer is, use word or pdf reader for printing.



  • @koahnig I am so sorry ,but we must use my app to do it not other third party tools
    ,and how to do?

      int resultCode = (int)ShellExecuteW(
                        NULL,QString("print").toStdWString().c_str()
                        ,QDir::toNativeSeparators(fileName).toStdWString().c_str()
                        ,NULL
                        ,NULL
                        ,SW_HIDE
                        );
            qDebug() << "print return code:" << resultCode;
    
    

    this is my code but not good for solves.
    when local machine not installed pdf reader tool .it can be faild by this way


  • Moderators

    @TobyYi

    I might be wrong, but I do not think that there is an independent solution available through Qt.

    You can create a pdf through QPdfWriter, but I am not aware of something in Qt of reading pdf files.
    For winword there is to my understanding the activeX stuff, but that would require an office installation as well.

    However, anybody may proof me wrong. It is for sure not my expertize.



  • @TobyYi
    for anything that Qt does not have a native api, you can always include other libaries.

    In your case something like this example should help you. That one is from the archives and for qt 4, so you may want to look for something more uptodate.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.