PDA

View Full Version : Print PDF under Windows



giusepped
8th January 2009, 09:43
I would like to understand better the printing engine.
I would print a PDF under Windows: is it possible?



void MyPlot::printOut()
{
QPrinter printer(QPrinter::HighResolution);

printer.setOutputFileName(tr("diagrammasolare.pdf"));

printer.setOutputFormat(QPrinter::PdfFormat);
printer.setCreator("Solar Calc");
printer.setOrientation(QPrinter::Landscape);

QPrintDialog dialog(&printer);
if ( dialog.exec() )
{
QwtPlotPrintFilter filter;
// if ( printer.colorMode() == QPrinter::GrayScale )
{
int options = QwtPlotPrintFilter::PrintAll;
options &= ~QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales;
filter.setOptions(options);
}

print(printer,filter);



}
}


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

riklaunim
8th January 2009, 11:47
Try using poppler bindings maybe? :)

init2null
8th January 2009, 18:27
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.

giusepped
9th January 2009, 00:17
me too, I have qt 4.4 on Windows, but always I get results as I wrote above....
:confused:
May you attach some code I can test on my platform?
Thanks

seneca
9th January 2009, 00:35
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.