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. QWebEnginePage and printToPdf Qt 5.7 issue

QWebEnginePage and printToPdf Qt 5.7 issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.1k Views 2 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.
  • freddy311082F Offline
    freddy311082F Offline
    freddy311082
    wrote on last edited by freddy311082
    #1

    Hi guys… I’m trying to use this function with qt 5.7 beta

    void QWebEnginePage::printToPdf(const QString &filePath, const QPageLayout &pageLayout)
    

    but, I have a problem with it because I don’t know when the pdf generation has finished, it seem like the pdf generation is running on other thread and I can’t know when it’s finish.

    does any one has any advise to do that? how Qt 5.7 notify that the pdf was generated successful or with error using this method?

    regards

    1 Reply Last reply
    0
    • JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      Yes, it runs in a separate thread. You have "2.5" choices:

      1. Upgrade to Qt 5.9, which has just added signal QWebEnginePage::pdfPrintingFinished .
      2. Use the Qt 5.7 QWebEnginePage::printToPdf(FunctorOrLambda resultCallback) overload which will call your own callback when it prints.
        2.5 Use a QFileSystemwatcher to monitor for file creation. [I am not keen on this one, e.g. QFileSystemWatcher::fileChanged() signal is probably(?) emitted as soon as file starts being written to rather than on writing completed.]

      See also my post on this forum for possible issue when waiting for printToPdf() to complete.

      1 Reply Last reply
      2

      • Login

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