Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33583

PDF output converts text to outline, rendering them un-searchable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.9.0
    • 4.8.5, 5.1.1, 5.2.0
    • None
    • Mac OS X 10.8.3, Mac OX 10.9
    • macOS

      When printing to PDF, all text in the resulting PDF are converted to outline path instead of character strings. This makes it impossible to search for text in the PDF.

      Run the sample code below and open the resulted PDF in Acrobat. Search for any text and none will be found. It also disallows coping text from the PDF. See the attached PDF.

      #include <QApplication>
      #include <QPrinter>
      #include <QPrintDialog>
      #include <QPainter>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QPrinter p;
          p.setOutputFileName("test.pdf");
          QPainter painter(&p);
          QFont f("Helvetica", 30);
          qDebug() << f.exactMatch();
          painter.setFont(f);
          painter.drawText(50, 150, "This text is not seachable.");
          painter.end();
          return 0;//a.exec();
      }
      
      

        1. test.pdf
          9 kB
          Stephen Chu
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            johnlayt John Layt
            stephenju Stephen Chu
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes