Skip to content
  • 1 Votes
    2 Posts
    370 Views
    S

    @SemP I have the exact same issue. Still looking for an answer. I tried using ‘file://‘ in my html href on PDFs, but it tries to open the PDF in a text editor.

    Older versions of Assistant had a PDF tab in preferences with a default PDF viewer configurable field, but not in this one…

    Still looking for a solution… I might start an http server and use http://localhost/pdffile.pdf because it will open http links in a web browser.

  • 0 Votes
    4 Posts
    578 Views
    batistaB

    @Majed-Y
    That's can do what you want....
    [link text](link url)https://github.com/qpdf/qpdf

  • 0 Votes
    2 Posts
    1k Views
    B

    I have found the answer!

    it is about the drawContents method of QTextDocument.
    There is a second parameter that you need to add in order to see the background image in your document.
    It's the a QRectF object that represend the size of the rect that the background image will be clipped into.

    void QTextDocument::drawContents(QPainter *p, const QRectF &rect = QRectF())
    Draws the content of the document with painter p, clipped to rect. If rect is a null rectangle (default) then the document is painted unclipped.

    So what I did is:

    easuresDoc.drawContents(&painter, pdfPrinter.paperRect()); // We print TextDocument of the Measures into the document pdfPrinter.newPage(); // We inject the current page and continue printing on new page averagesDoc.drawContents(&painter, pdfPrinter.paperRect()); // We print the TextDocument of the Averages into the document pdfPrinter.newPage(); // We inject the current page and continue printing on new page inOutDoc.drawContents(&painter, pdfPrinter.paperRect()); // We print the TextDocument of the Inputs/Outputs into the document

    pdfPrinter.paperRect is the rectangle of the page without the margin.

    Also if you want the background image to be printed scaled with no repeat than you need to put the printer into QPrinter::PrinterResolution

    QPrinter pdfPrinter(QPrinter::PrinterResolution);

  • 0 Votes
    7 Posts
    2k Views
    K

    syntax from documentation for border <width>px <border-style> <border-color>
    That's mean it should be px after border.

  • Qt6 Displaying PDF Files

    Unsolved Qt 6
    2
    0 Votes
    2 Posts
    616 Views
    SGaistS

    Hi and welcome to devnet,

    Based on the Marketplace, I would say not available yet for Qt 6.

    The build instructions are still Qt 5 only. The module will likely return around the same time QtWebEngine for Qt 6 is released.

  • 0 Votes
    3 Posts
    724 Views
    jeanmilostJ

    @mrjj Thank you for your answer. So I tested to remove the text rectangle passed to the drawContents() function, and indeed the global clipping was applied instead.

  • 0 Votes
    4 Posts
    2k Views
    jeanmilostJ

    Thank you for the answers, they provide very valuable info. So there is no real way to have a generic PDF printer, and each developer have to write its own, by writing its own Paint() function. That was that I though, unfortunately.

    Unfortunately, because writing my own drawing function brings another issue in my case: I cannot get back the content of the delegate property encapsulated inside my TableView object, in my qml interface file from the c++ code. More exactly, I can, in the best situation, retrieve a part of these info, by getting back the items already drawn on the user interface, from the TableView cache. But as not all the items may be available in this case, I may miss important info in various scenarios, e.g.for still not painted items. Or I may also hardcode the values to use during the PDF export inside the c++ code to reflect what was did in the qml file.

    These solutions may resolve my issue in a certain manner, but are weak in terms of generating good and reusable code, especially when designers are intended to often modify the qml interface during the development cycles.

    I perhaps will explore the QTextDocument object, and the way it handles the PDF printing. However I don't know if I really can use this component to replace my qml TableView object, as its organization was exactly what I needed to show my data to the user. I will also take a look in the QtWebEngine solution, but this may work only if the text remains editable in the generated PDF, as I said in my original post above.

  • 0 Votes
    4 Posts
    2k Views
    J.HilkJ

    Turns out, with an android target of 23 or older my approach is more than fine. But google decided to make it more complicated going forwards. As 23 is no longer viable version for updates.

    So, I read through the block post (multiple times), extracted everything I needed and managed to cram everything into one java file.

    also I get this warning:

    WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

    since it's now April 2019 I'm going to ignore that until it bites me in the back ;-)

    All in all I'm once again reminded why I'm not a fan of Java....

    Thanks @VRonin and @ekkescorner , for helping me solve this, very much appreciated.

  • 0 Votes
    11 Posts
    8k Views
    JonBJ

    @Qjay
    This may not help because I do not know quite how you would do this directly from Qt, but when we want to print a PDF under Windows we use the underlying Win32 function ShellExecute() (https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx) to go (effectively) ShellExecute("print", native-path-to-file), and let Windows shell sort it out.

    This is effectively the same as right-clicking on the file and picking the Print action. So you don't need to know anything about the actual process which does the printing, its arguments etc.

  • 0 Votes
    1 Posts
    790 Views
    No one has replied
  • Print PDF/A Archive format

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    778 Views
    ?

    Hi! My first thought was to use the PDF generation that Qt offers and then simply convert the produced documents to PDF/A with Ghostscript. That should go like gs -dPDFA ....

  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi,

    You should check the bug report system to see if it's something known. If not please consider opening a new report providing your example and as many details as possible about your setup.

  • 0 Votes
    11 Posts
    5k Views
    P

    OK, so now that I have launched the program with admin rights and came back with user session, the application is working (?!?)

    So it was neither a DLL or plugins problem, but just a weird right access blocking. I am sad I can't explain why I had to launch it once with admin session, but at least I am glad I solved my problem.

    Thanks anyway to those who give their time to help.

  • 0 Votes
    38 Posts
    33k Views
    JonBJ

    @MarieBurgan
    Thanks for the plug. I'm sure @geor will thank you for this tip, if he visits here now two years after he last posted... ;-)

  • 0 Votes
    4 Posts
    3k Views
    raven-worxR

    @Shidharth
    Maybe you can extract a QWebElement and insert it into a separate QWebView and use print(). But i think it may not look the same as in the origin QWebView.

    Also maybe there is a possible JavaScript way?

  • Hint about help documentation

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    1k Views
    M

    Found: Sphinx

  • 0 Votes
    4 Posts
    3k Views
    SGaistS

    You can find an example of this in the "Advanced Qt Programming: Creating Great Software with C++ and Qt 4" book code samples.

  • 0 Votes
    3 Posts
    3k Views
    MassiM

    @SGaist
    Hi! yes I have checked this before but I dropped it, I got many errors because I don't know how to link the libraries in the command prompt

    'nmake -f makefile.vc TARGET=rel'

    And the link does not contain Qt5 . When I downloaded the latest release of poppler, it didn't come with makefile.vc file. So I decided to go with CMake GUI.

    I'm not comfortable with makefiles, I prefer to use CMake GUI (easy to include lib & dir) since I already built zlib, freetype and libjpeg libraries in vs2013 win64

    Regards,

  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi and welcome to devnet,

    You should also try to contact the author of the module. He might be able to help you since he wrote that code.