Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Anybody who knows how to print local word and pdf files?QPrinter cann't do it.so any workground?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • TobyYiT Offline
    TobyYiT Offline
    TobyYi
    wrote on last edited by koahnig
    #1

    Re: QPrinter margins

    将QtCoding进行到底,做Qt的宠儿
    关注移动互联网,关注手机助手
    开发即时通讯,服务于金融行业
    My github :https://github.com/toby20130333

    K 1 Reply Last reply
    0
    • TobyYiT TobyYi

      Re: QPrinter margins

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @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.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • TobyYiT Offline
        TobyYiT Offline
        TobyYi
        wrote on last edited by
        #3

        @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

        将QtCoding进行到底,做Qt的宠儿
        关注移动互联网,关注手机助手
        开发即时通讯,服务于金融行业
        My github :https:&#x2F;&#x2F;github.com&#x2F;toby20130333

        K J.HilkJ 2 Replies Last reply
        0
        • TobyYiT TobyYi

          @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

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @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.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          1
          • TobyYiT TobyYi

            @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

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @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.


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved