Results 1 to 5 of 5

Thread: Print PDF under Windows

  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Print PDF under Windows

    I would like to understand better the printing engine.
    I would print a PDF under Windows: is it possible?

    Qt Code:
    1. void MyPlot::printOut()
    2. {
    3. QPrinter printer(QPrinter::HighResolution);
    4.  
    5. printer.setOutputFileName(tr("diagrammasolare.pdf"));
    6.  
    7. printer.setOutputFormat(QPrinter::PdfFormat);
    8. printer.setCreator("Solar Calc");
    9. printer.setOrientation(QPrinter::Landscape);
    10.  
    11. QPrintDialog dialog(&printer);
    12. if ( dialog.exec() )
    13. {
    14. // if ( printer.colorMode() == QPrinter::GrayScale )
    15. {
    16. int options = QwtPlotPrintFilter::PrintAll;
    17. options &= ~QwtPlotPrintFilter::PrintBackground;
    18. options |= QwtPlotPrintFilter::PrintFrameWithScales;
    19. filter.setOptions(options);
    20. }
    21.  
    22. print(printer,filter);
    23.  
    24.  
    25.  
    26. }
    27. }
    To copy to clipboard, switch view to plain text mode 
    With this code, which is good under windows, I cannot get printing the pdf under windows.
    No dialog shows up and the message
    only native format supported is shown.

    So, is it possible to print pdf under Windows?
    G

  2. #2
    Join Date
    Dec 2008
    Posts
    16
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Print PDF under Windows

    Try using poppler bindings maybe?

  3. #3
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Print PDF under Windows

    Yes, it is possible, since I print PDFs in my programs on Windows all the time. What version of Qt are you using? I've used Qt 4.4 and 4.5 beta to generate them.
    ImageRocket - My Qt4-based image editing program
    Project Page / Screenshots / Source

  4. #4
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Print PDF under Windows

    me too, I have qt 4.4 on Windows, but always I get results as I wrote above....

    May you attach some code I can test on my platform?
    Thanks

  5. #5
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Print PDF under Windows

    I think the problem is that using the print dialog is not appropriate for pdf output, only for real printer. Printing pdf works for me, but I dont use a print dialog.

  6. The following user says thank you to seneca for this useful post:

    giusepped (10th January 2009)

Similar Threads

  1. Opening text file fails after autostartup on windows
    By yogourta in forum Qt Programming
    Replies: 2
    Last Post: 18th October 2008, 03:52
  2. Audio/Video Preview on Windows?
    By vishal.chauhan in forum Qt Programming
    Replies: 0
    Last Post: 2nd May 2008, 06:10
  3. Windows not appearing in XP.
    By beardybloke in forum Qt Programming
    Replies: 7
    Last Post: 24th October 2007, 17:32
  4. converting unix exe to windows binary
    By deekayt in forum General Programming
    Replies: 2
    Last Post: 17th September 2006, 01:00
  5. MDI windows without QWorkspace
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 17:15

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.