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. Print ODT File
Forum Updated to NodeBB v4.3 + New Features

Print ODT File

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 4 Posters 1.1k Views 3 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.
  • C Offline
    C Offline
    ckvsoft
    wrote on 14 Apr 2020, 15:49 last edited by
    #1

    Hallo
    I'm looking for stupid. Is there a way to print existing .ODT files from QT?
    lf Chris

    J 1 Reply Last reply 14 Apr 2020, 19:40
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Apr 2020, 17:24 last edited by
      #2

      Hi,

      There's the Qt Print Support module.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ckvsoft
        wrote on 14 Apr 2020, 19:17 last edited by
        #3

        Thx. I know this class, but how can i use it for .ODT files?
        QTextDocument do not Support These type and QTextDocumentWriter only create such file.

        Lg chris

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 14 Apr 2020, 19:34 last edited by
          #4

          I think you should take a look at Okular, they have support for odt files.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • C ckvsoft
            14 Apr 2020, 15:49

            Hallo
            I'm looking for stupid. Is there a way to print existing .ODT files from QT?
            lf Chris

            J Offline
            J Offline
            JonB
            wrote on 14 Apr 2020, 19:40 last edited by
            #5

            @ckvsoft
            As @SGaist says. No builtin support in Qt. However, if Okular route is not your thing, are you under Linux (Debian)?

            1 Reply Last reply
            0
            • C Offline
              C Offline
              ckvsoft
              wrote on 14 Apr 2020, 20:38 last edited by
              #6

              Okular do chris but very bad. Styles are missing. I van convert to html this looks Good in Firefox but mit in QtextDocument
              Is There a List wich html tags QTextDocument understand?
              Or do you know a third party class

              Lg chris

              J 1 Reply Last reply 14 Apr 2020, 21:42
              0
              • C ckvsoft
                14 Apr 2020, 20:38

                Okular do chris but very bad. Styles are missing. I van convert to html this looks Good in Firefox but mit in QtextDocument
                Is There a List wich html tags QTextDocument understand?
                Or do you know a third party class

                Lg chris

                J Offline
                J Offline
                JonB
                wrote on 14 Apr 2020, 21:42 last edited by
                #7

                @ckvsoft
                You did answer whether you are under Linux (Debian)? You can print --- which is what you said you want to do --- from there if so without trying to read it in. I don't think you will be able to "read" ODT file into Qt/QTextDocument.

                C 1 Reply Last reply 14 Apr 2020, 22:04
                0
                • J JonB
                  14 Apr 2020, 21:42

                  @ckvsoft
                  You did answer whether you are under Linux (Debian)? You can print --- which is what you said you want to do --- from there if so without trying to read it in. I don't think you will be able to "read" ODT file into Qt/QTextDocument.

                  C Offline
                  C Offline
                  ckvsoft
                  wrote on 14 Apr 2020, 22:04 last edited by
                  #8

                  @JonB
                  Currently ubuntu.
                  Open read and convert is not the Problem. But QTextDocument has limited html tags. So i can print but ist not formated as it schould be.So i am searching for a lib that can do this.
                  Install libre is Overkill for only print a odt.
                  Okular will also Show without styles.

                  Lg chris

                  J 1 Reply Last reply 14 Apr 2020, 22:44
                  0
                  • C ckvsoft
                    14 Apr 2020, 22:04

                    @JonB
                    Currently ubuntu.
                    Open read and convert is not the Problem. But QTextDocument has limited html tags. So i can print but ist not formated as it schould be.So i am searching for a lib that can do this.
                    Install libre is Overkill for only print a odt.
                    Okular will also Show without styles.

                    Lg chris

                    J Offline
                    J Offline
                    JonB
                    wrote on 14 Apr 2020, 22:44 last edited by
                    #9

                    @ckvsoft
                    If you are saying you have HTML, QWebEnginePage can print that.

                    C 2 Replies Last reply 15 Apr 2020, 08:34
                    1
                    • J JonB
                      14 Apr 2020, 22:44

                      @ckvsoft
                      If you are saying you have HTML, QWebEnginePage can print that.

                      C Offline
                      C Offline
                      ckvsoft
                      wrote on 15 Apr 2020, 08:34 last edited by
                      #10

                      @JonB
                      Thx. I will try this today. Good idea
                      Lg chris

                      1 Reply Last reply
                      0
                      • J JonB
                        14 Apr 2020, 22:44

                        @ckvsoft
                        If you are saying you have HTML, QWebEnginePage can print that.

                        C Offline
                        C Offline
                        ckvsoft
                        wrote on 15 Apr 2020, 13:13 last edited by
                        #11

                        @JonB
                        Incredible. QWebEnginePage show shows me everything wonderfully, but the print preview / printout is a blank page

                        lg Chris

                        mrjjM J 2 Replies Last reply 15 Apr 2020, 13:18
                        0
                        • C ckvsoft
                          15 Apr 2020, 13:13

                          @JonB
                          Incredible. QWebEnginePage show shows me everything wonderfully, but the print preview / printout is a blank page

                          lg Chris

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 15 Apr 2020, 13:18 last edited by
                          #12

                          Hi
                          That sounds like a bummer.
                          Could you try
                          https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-html2pdf-example.html

                          and see if that give same result ?

                          1 Reply Last reply
                          3
                          • C ckvsoft
                            15 Apr 2020, 13:13

                            @JonB
                            Incredible. QWebEnginePage show shows me everything wonderfully, but the print preview / printout is a blank page

                            lg Chris

                            J Offline
                            J Offline
                            JonB
                            wrote on 15 Apr 2020, 15:48 last edited by JonB
                            #13

                            @ckvsoft
                            We use it to print HTML->PDF. You have to be careful about how your code works, to do with QWebEnginePage being asynchronous, IIRC. Please give a go to @mrjj's example.

                            1 Reply Last reply
                            0
                            • C Offline
                              C Offline
                              ckvsoft
                              wrote on 17 Apr 2020, 08:25 last edited by
                              #14

                              Summarized:
                              I'll keep looking. I had no idea that it would be so cumbersome.
                              First I wrote a class that uses an OTT as a template to create the ODT file. At that time I did not know that it was cumbersome to display or print this file. Converted to HTML is not displayed correctly by QtextEdit. So we have to use QWebEngine. But now I noticed that the conversion to html is also not 100%. During this time I would have probably written my own template designer. I actually wanted to avoid that. I have no idea what I'm going to do now.

                              lg Chris

                              1 Reply Last reply
                              0

                              1/14

                              14 Apr 2020, 15:49

                              • Login

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