Przejdź do treści
  • Kategorie
  • Ostatnie
  • Tagi
  • Popularne
  • Użytkownicy
  • Grupy
  • Szukaj
  • Get Qt Extensions
  • Unsolved
Zwiń
Logo forum
  1. Start
  2. Qt Development
  3. General and Desktop
  4. QT 6 PDF printer not embedding font properly
Forum Updated to NodeBB v4.3 + New Features

QT 6 PDF printer not embedding font properly

Zaplanowany Przypięty Zablokowany Przeniesiony Solved General and Desktop
8 Posty 3 Uczestników 1.2k Wyświetlenia 2 Obserwuje
  • Najpierw najstarsze
  • Najpierw najnowsze
  • Najwięcej głosów
Odpowiedz
  • Odpowiedz, zakładając nowy temat
Zaloguj się, aby odpowiedzieć
Ten temat został usunięty. Mogą go zobaczyć tylko użytkownicy upoważnieni do zarządzania tematami.
  • Q Niedostępny
    Q Niedostępny
    qtguy07
    napisał ostatnio edytowany przez qtguy07
    #1

    Hi together.
    I've recently switched to Qt 6 and experiencing some problems with QPdfWriter and QPrinter (printing pdf). The Font is always not embedded properly, even it is installed. To test that, I tried following Code:

    (Added in .pro file) QT += printsupport
    
    QPdfWriter writer("C:/Users/GGG/Desktop/lol.pdf");
    writer.setResolution(300);
    writer.setPageSize(QPageSize(QPageSize::A4));
    writer.newPage();
    QPainter painter;
    painter.begin(&writer);
    painter.drawText(600,600,"Hello, this is a test");
    painter.end();
    

    -> Font is embedded fine with Qt 5.15.2, but no more with Qt 6.0.0 :(
    Can one of you test my Code (Run with Qt 6 and open the .pdf file) and give your feedback? I checked everything on my System... I fear it's a Qt 6 specific problem.




    Or does someone have any advice? I tested following things:

    • Check the doc's and internet -> didn't found anything useful

    • read out the font (there is one embedded, but faulty)

    • Change font of QPainter to "Calibri"

    • check if the font is aviable with db.hasFamily("Calibri"); (return value = true)

    • Check graphics card driver -> installed rightly, no updates aviable.

    • Rebuild with Qt 5.15.2 (in both cases MinGW64) -> Font is embedded correctly. But gone if I turn back to Qt version 6.0.0

    • Checked my QT components -> I have installed for Qt 6.0.0: MinGW 8.1.0 64Bit, Sources, Qt 5 compatibility Module, Qt Shader Tools, Qt Debug Information Files.

    • list itemtried the same with QPrinter wich prints Pdf files - same behaviour.

    My Setup:
    Windows 10, 64bit - used fonts are installed.
    Qt creator 4.14.0 - MinGW64 with Qt 6.0.0

    1 odpowiedź Ostatnia odpowiedź
    0
    • Q qtguy07

      Ok, thank you a lot for your effort. It looks like you had the same problem. If I open your file with Adobe reader, the Font isn't embedded properly. According to that, I guess it's not a problem caused by my system.

      Are there any faults in my code or could the problem be in Qt6? And if so, does anyone know the best way to report the bug?

      mrjjM Niedostępny
      mrjjM Niedostępny
      mrjj
      Lifetime Qt Champion
      napisał ostatnio edytowany przez
      #4

      @qtguy07

      Hi
      Looks like something in Qt6.

      Open bug report here
      https://bugreports.qt.io/secure/Dashboard.jspa
      please attach a small runnable example app and
      all information possible. maybe screenshot of the text in the pdf when right and when not.

      Also maybe short info on how you check in Adobe Reader.
      (i don't have that installed so could not check)

      but just from the fact, the same code on the same system produces different looking PDF
      depending on Qt5 or Qt6. then I would say something is up.

      Please post the bug ticket link here so other can vote on the issue.

      1 odpowiedź Ostatnia odpowiedź
      1
      • mrjjM Niedostępny
        mrjjM Niedostępny
        mrjj
        Lifetime Qt Champion
        napisał ostatnio edytowany przez
        #2

        Hi
        resulting pdf. win 10. qt6 mingw
        https://www.dropbox.com/s/jxamlp1ub2dd9ak/lol2.pdf?dl=0

        1 odpowiedź Ostatnia odpowiedź
        1
        • Q Niedostępny
          Q Niedostępny
          qtguy07
          napisał ostatnio edytowany przez
          #3

          Ok, thank you a lot for your effort. It looks like you had the same problem. If I open your file with Adobe reader, the Font isn't embedded properly. According to that, I guess it's not a problem caused by my system.

          Are there any faults in my code or could the problem be in Qt6? And if so, does anyone know the best way to report the bug?

          mrjjM 1 odpowiedź Ostatnia odpowiedź
          0
          • Q qtguy07

            Ok, thank you a lot for your effort. It looks like you had the same problem. If I open your file with Adobe reader, the Font isn't embedded properly. According to that, I guess it's not a problem caused by my system.

            Are there any faults in my code or could the problem be in Qt6? And if so, does anyone know the best way to report the bug?

            mrjjM Niedostępny
            mrjjM Niedostępny
            mrjj
            Lifetime Qt Champion
            napisał ostatnio edytowany przez
            #4

            @qtguy07

            Hi
            Looks like something in Qt6.

            Open bug report here
            https://bugreports.qt.io/secure/Dashboard.jspa
            please attach a small runnable example app and
            all information possible. maybe screenshot of the text in the pdf when right and when not.

            Also maybe short info on how you check in Adobe Reader.
            (i don't have that installed so could not check)

            but just from the fact, the same code on the same system produces different looking PDF
            depending on Qt5 or Qt6. then I would say something is up.

            Please post the bug ticket link here so other can vote on the issue.

            1 odpowiedź Ostatnia odpowiedź
            1
            • Q Niedostępny
              Q Niedostępny
              qtguy07
              napisał ostatnio edytowany przez
              #5

              @mrjj said in QT 6 PDF printer not embedding font properly:

              Please post the bug ticket link here so other can vote on the issue.

              Perfect. Thanks for your answer and help. I searched on the bugreports page. Someone posted this bug alredy.
              See here for more details: https://bugreports.qt.io/browse/QTBUG-89727

              1 odpowiedź Ostatnia odpowiedź
              0
              • Christian EhrlicherC Niedostępny
                Christian EhrlicherC Niedostępny
                Christian Ehrlicher
                Lifetime Qt Champion
                napisał ostatnio edytowany przez
                #6

                Very nice and subtle bug - the container size was changed from int32_t to int64_t and the font serialization simply used QByteArray::size() without a cast.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                Q 1 odpowiedź Ostatnia odpowiedź
                3
                • Christian EhrlicherC Christian Ehrlicher

                  Very nice and subtle bug - the container size was changed from int32_t to int64_t and the font serialization simply used QByteArray::size() without a cast.

                  Q Niedostępny
                  Q Niedostępny
                  qtguy07
                  napisał ostatnio edytowany przez
                  #7

                  @Christian-Ehrlicher Thanks for researching and fixing the error.

                  That will allow me to continue using Qt 6.0 without revert my code to 5.15.

                  1 odpowiedź Ostatnia odpowiedź
                  0
                  • Christian EhrlicherC Niedostępny
                    Christian EhrlicherC Niedostępny
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    napisał ostatnio edytowany przez Christian Ehrlicher
                    #8

                    It was just luck - and the easy testcase. :)

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    1 odpowiedź Ostatnia odpowiedź
                    2

                    • Zaloguj się

                    • Aby wyszukiwać zaloguj się lub zarejestruj.
                    • Pierwszy post
                      Ostatni post
                    0
                    • Kategorie
                    • Ostatnie
                    • Tagi
                    • Popularne
                    • Użytkownicy
                    • Grupy
                    • Szukaj
                    • Get Qt Extensions
                    • Unsolved