[Qt-interest] Merging / printing multiple pdf's

Christopher Rasch-Olsen Raa christopher at technophile.info
Sat Aug 8 20:50:07 CEST 2009


Hi,

In an application I'm writing I have a situation where I have to take X number 
of different pdf's and send them to a printer. The way it is solved today is 
that the application opens each and every one of the pdf's using 
QDesktopServices and then the user have to press 'Print' from whichever pdf-
reader they use. This however is not an optimal solution. Try opening a couple 
of hundred singlepage pdf's at the same time and experience some _real_ lag.

What I'd like to do is to take all the different pdfs that need printing and 
merge them into one, and then open them using QDesktopServices OR just do some 
behind the scenes magic and send it all directly to a printer without opening 
an external application.

A while pack I approached this list with almost the same question, and some 
helpful person pointed me to the 'poppler'-library as featured in Qt 
Quarterly. I looked into that but got the impression that it was only meant 
for viewing pdf's, not really manipulating them. Am I mistaken?

I did a small experiment where I rendered the pages from the different pdf into 
an array of QImages (using poppler), created a QPrinter and QPainter and 
painted all of the images to pages. This worked ok, with one small exception; 
the content of the pdfs did not have the same positions as when I printed them 
by themselves using an external pdf-reader. These are forms, so the content 
really should be placed where it is supposed to be. :p

Have anyone tried to do, or have done, anything similar to this? If so, what 
have worked for you? Do any of you have any other pointers for me?

-- 
Christopher



More information about the Qt-interest-old mailing list