PDA

View Full Version : Help creating a PDF doc



Dark_Tower
8th December 2006, 18:17
Hi, I'm programing an application for the management (leveling and cut away the background) of digitalized images taken from the pages of old books. The last step of the processment is the creation of a PDF document with all the processed images (one image per page) to create the corresponding e-book (see the pics below). Well, I've tried to create the PDF document with the QPrinter class and "painting" the images on it using the QPainter class. The problem is that, doing it in this way, it doesn't include the original images and the resulting PDF doc is even larger than the group of images :( I would like to know if somebody knows a software (freeware if it's possible) that could comunicate with Qt and could create PDF docs from images, like I've already descripted. Thanks a lot.

wysota
8th December 2006, 20:02
Adobe Distiller maybe? If not, then ghostscript.

Brandybuck
8th December 2006, 20:39
Since the PDF appears to be fairly simple (one image per page), then you might consider directly generating the PDF. I don't know the PDF spec, but it can't be too hard to do this for such a simple document.

Dark_Tower
9th December 2006, 10:02
Thanks wysota but Brandybuck (thanks too) has made me realized that maybe all what I need is just some libraries for the creation of PDF docs and for the attachment of images on them. The problem is that I don't know where to find them :(
Another solution could be taking advantage of the fact that Qt is opensource and search for its sources where it compresses the images in the pdf docs. I'm nearly sure that it fixes a compression level. I would like to change it. That would do the trick, too. I've been reading QPrinter and QPainter but It's a little complex to find where it generates the PDF (:( again)

wysota
9th December 2006, 11:39
AFAIK Qt doesn't do any special compression, it just sticks images into the pdf. Optimisations are planned for future releases.

Dark_Tower
10th December 2006, 12:43
Hi again, finally seems that my suposition was true (which I'm happy :D ) and Qt seems to fix the compression level in the file "qprintengine_pdf.cpp" line 519 with a value of 95. Reading a bit the method "addImage" seems a bit "dirty" because, for example, if we create a QImage from a JPEG image, then, internally, the image is compressed again to jpeg :eek: So, why they don't create a method to include the original image, as I've said before? I hope that in the future would be possible... I also hope that this helps somebody else with this problem ;)