Printing in Qt window with dotted lines produce huge PDF file and slow
Hi,
I have grid lines with dotted line style, when print it into PDF in Windows, it creates huge PDF file (~100MB) and take ages to finish.
Printing solid line style is reasonable fast and file is less than 200k.
In linux, all are good.
Any one has any suggestions what may be wrong?
Thanks!
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
Do you use the exact same settings for printing on Windows and Linux? Looks like on Windows your code rasterizes every dot in a line.
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
Yes, all codes are identical. Just recompile them.
I use Adobe Acrobat when printing to PDF on Windows.
I saw someone asking the same question at
http://stackoverflow.com/questions/1...d-to-big-files
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
Quote:
Originally Posted by
lni
I use Adobe Acrobat when printing to PDF on Windows.
Can you be a bit more specific who Adobe Acrobat is involved here?
Do you print using a PDF Pseudo printer provided by Adobe Acrobat?
Cheers,
_
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
Quote:
Originally Posted by
anda_skoa
Can you be a bit more specific who Adobe Acrobat is involved here?
Do you print using a PDF Pseudo printer provided by Adobe Acrobat?
Cheers,
_
Yes, I use PDF Pseudo printer provided by Adobe Acrobat.
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
Quote:
Originally Posted by
lni
Yes, I use PDF Pseudo printer provided by Adobe Acrobat.
So shouldn't you be asking this question on Adobe forums? :)
Why don't you use PDF printing facilities built into Qt?
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
Quote:
Originally Posted by
wysota
So shouldn't you be asking this question on Adobe forums? :)
Why don't you use PDF printing facilities built into Qt?
I am using the one built by Qt.
When click "Print", It pops up a dialog to select a printer, and I can select a real printer, or "Adobe PDF" virtual printer. Then QGraphicsScene::render is called to print the content.
Do I use it wrong?
Thanks
Re: Printing in Qt window with dotted lines produce huge PDF file and slow
You are asking Qt to send the output to a printer. Qt does not care that is is not a physical printer or what that printer does with it. If Adobe's Distller chooses to make a high resolution raster image of a page that has nothing to do with Qt.
If you ask Qt to render directly to a PDF, with QPrinter::setOutputFormat() and QPrinter::setOutputFileName(), then you are likely to get a different result because Qt has some control. Try this experiment:
Code:
#include <QApplication>
#include <QPainter>
#include <QPrinter>
#include <QPen>
int main(int argc, char **argv)
{
printer.
setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("test.pdf");
QRect rect
= printer.
pageRect();
rect.moveTo(0, 0);
p.
setPen(QPen(Qt
::DashLine));
p.drawRect(rect);
for (int i = 0; i < rect.height(); i += rect.height() / 50) {
}
p.end();
return 0;
}