Results 1 to 4 of 4

Thread: Generate PDF

  1. #1
    Join Date
    Mar 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Generate PDF

    There's a way to "paint" to an SVG file using QSvgGenerator class (link). Is there a way to generate PDF files, or do I have to convert from SVG to PDF using an external program.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Generate PDF

    You can use QPrinter::PdfFormat:
    Qt Code:
    1. QSvgRenderer renderer("filename.svg");
    2.  
    3. QPrinter printer;
    4. printer.setOutputFormat(QPrinter::PdfFormat);
    5. printer.setOutputFileName("filename.pdf");
    6.  
    7. QPainter painter(&printer);
    8. renderer.render(&painter);
    9. painter.end();
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Jun 2008
    Posts
    35
    Thanks
    5
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Generate PDF

    You can use QPrinter to generate pdf :

    Qt Code:
    1. QPrinter printer;
    2. printer.setOutputFileName("My Report.pdf");
    3. printer.setOutputFormat(QPrinter::PdfFormat);
    4. printer.setPaperSize(QPrinter::A4);
    To copy to clipboard, switch view to plain text mode 

    P.S : Have a look at the attached file ; it's a small application that generates & print PDF .
    Hope to be Helpful .
    Attached Files Attached Files

  4. #4
    Join Date
    Jun 2007
    Location
    italy
    Posts
    126
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Generate PDF

    I tried to use your application but it does not send a pdf file to printer. It only treats text file and not binary file..Am I right? Or am i missing something?

    Thank you

Similar Threads

  1. Generate image checksum
    By bunjee in forum Qt Programming
    Replies: 14
    Last Post: 10th June 2008, 01:16
  2. how to generate debug file???
    By sudheer in forum Qt Tools
    Replies: 2
    Last Post: 1st May 2008, 23:03
  3. Generate a correct makefile
    By SteM in forum Installation and Deployment
    Replies: 13
    Last Post: 22nd October 2007, 08:58
  4. how can i generate .cpp file in QT 4.3.0
    By gamitkumar in forum General Programming
    Replies: 4
    Last Post: 3rd September 2007, 22:23
  5. Replies: 12
    Last Post: 14th June 2006, 09:24

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.