Quote Originally Posted by munna View Post
See if this helps.
Ok the link what you have given prints to a PDF.
But my problem is as follows

First I draw images on QFrame, then using QPrinter and QPainter classes defined in Qt3.3.5 I'm able to print into pages. It works quite fine.

I can print to a file. Now I want printing to a pdf file such that I can have a "*.pdf" file. If I'm not clear please see the code below and tell me what I should do????

Qt Code:
  1. void printToPrinter()
  2. {
  3. QPrinter printer( QPrinter::HighResolution );
  4. printing = TRUE;
  5. printer.setPageSize ( mappings.pageSize() );
  6. printer.setOrientation( mappings.orientation() );
  7. printer.setOutputFileName ( (const char *)chemGlobals->printerDefaultFilename() );
  8. printer.setOutputToFile ( FALSE );
  9. printer.setFullPage( TRUE );
  10.  
  11. // Run the printer setup dialog, and if the user clicks 'ok' then
  12. // do the actual printing
  13. #if defined(_OS_WIN32_) || defined(Q_OS_WIN32)
  14. if ( printer.setup( this ) )
  15. #else
  16. // if ( QPrintDialog::getPrinterSetup( &printer ) )
  17. QPrintDialog printerDialog( &printer );
  18. printerDialog.setPrinter( &printer, TRUE );
  19. if( printerDialog.exec() )
  20. #endif
  21. p.begin( &printer );
  22. //drawToPrinter
  23. p.end
  24. }
To copy to clipboard, switch view to plain text mode 
This code is to print to a file, how can I print to PDF file???

Thankx