Results 1 to 3 of 3

Thread: QPrinter::PdfFormat html format && Link

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QPrinter::PdfFormat html format && Link

    I search a way to make link active on pdf export from qt.... && on future to make textinput field , combobox like latex
    \usepackage[bookmarks=false]{hyperref} to send and validate data to db or email...

    Now if i must make a link enable pdf ( manual how-to ecc.. ) i export html file with my qt apps
    svn co https://qt-webdav.svn.sourceforge.ne...v/html_editor/ html_editor
    && open html file on openoffice && export to pdf ...

    Is here a way to subclass QPrinter and make link active?

    The only way i know is xslt html2fop (apache fop processor) to make link ... and now fop can parse xforms standard to make input field...

    But i am sure QPrinter not required java to make the same job....


    Qt Code:
    1. void Edit_html::MakefilePrintPdf()
    2. {
    3. QString fileName = QFileDialog::getSaveFileName(this, "Export PDF",QString(setter.value("LastDir").toString()), "*.pdf");
    4. if (fileName.size() > 1) {
    5. QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    6. QPrinter printer(QPrinter::HighResolution);
    7. printer.setOutputFormat(QPrinter::PdfFormat);
    8. if (!fileName.endsWith(".pdf")) {
    9. fileName = fileName+".pdf";
    10. }
    11. QString ultimacartellaaperta = fileName.left(fileName.lastIndexOf("/"))+"/";
    12. setter.setValue("LastDir",ultimacartellaaperta);
    13. printer.setOutputFileName(fileName);
    14. wtext->document()->print(&printer); /* wtext qtextedit */
    15. if (is_file(fileName)) {
    16. QApplication::restoreOverrideCursor();
    17. OpenDesktop(QUrl(fileName));
    18. }
    19. }
    20. QApplication::restoreOverrideCursor();
    21. }
    To copy to clipboard, switch view to plain text mode 

    on openoffice 2 pdf export link show like this here....

    5 0 obj
    <</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[69.5 766 376.4 784.5]/A<</Type/Action/S/URI/URI(http://www.qtcentre.org/component/option,com_weblinks/task,view/catid,14/id,27/)>>
    >>
    endobj
    On latex pdflatex textinput field look like this here....


    37 0 obj <<
    /Type /Annot
    /Rect [567.0667 284.7431 724.9647 298.6908]
    /Subtype /Widget /F 4 /T (FIELDNAME) /Q 0 /FT /Tx /BS << /W 1 /S /S >> /MK << /BC [0.85 0.85 0.85] /BG [0.89 0.94 0.95] >> /DA (/Helv 11 Tf 0 0 0 rg ) /DV () /V (VALUEDATAHUMAN) /AA << >>
    >> endobj
    on attachment the qt pdf output from copy & paste link section qtcentre.org
    and same from openoffice
    Attached Files Attached Files
    Last edited by jacek; 8th April 2007 at 14:11. Reason: changed [code] to [quote]

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPrinter::PdfFormat html format && Link

    You cannot subclass QPrinter. At most you can subclass QPrintEngine, but there's little you can do with it.

    A tedious solution is to take pdf support from Qt( from QPrinter ) and make your own class
    of PDF Export.

    Also, if all you want si save some text, you can make you're own PDF Export ( not based on QPrinter ). Just take the text from the QTextEdiot and saver it in pdf. It isn't that hard to add a few fonts to the page resources and text to the content stream.

    Regards

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPrinter::PdfFormat html format && Link

    Quote Originally Posted by marcel View Post
    You cannot subclass QPrinter.
    Also, if all you want si save some text, you can make you're own PDF Export ( not based on QPrinter ). Just take the text from the QTextEdiot and saver it in pdf. It isn't that hard to add a few fonts to the page resources and text to the content stream.
    Regards
    Hmmm... Crazy. Back to latex or hope XSL-FO becomes perfect... ( link have it) now only textinput or combobox must work on XForms ..

    qt xhtml import to scribus come bad link .. and not import image... on absolute path!
    scribus have all perfect... only import && plugin are all on Python and i know only PHP or c++ qt , perl...

Similar Threads

  1. Html link color
    By sreedhar in forum Qt Programming
    Replies: 9
    Last Post: 5th September 2008, 14:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.