Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Lessons learned loading TIF images |
Post Reply ![]() |
Author | |
JimCanuck ![]() Beginner ![]() Joined: 13 Aug 07 Location: Canada Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() Posted: 16 Aug 07 at 2:31PM |
All:
After some great help (thanks Marian!) learning the basics of converting TIF images to PDF documents, I discovered a few problems and tricks along the way that I will now share. I'm working in VB6.
After initially getting over the hump of learning that you must not only use
QP.AddImageFromFile(tifFileName, 0) but also QP.DrawImage(left, top, width, height....) as well (image that...), and discovering the right co-ordinate system, so that I acutally drew the image ON the page....
I found the images I was adding were not appearing correctly in the PDF document.
I was adding TIF images, 8 bit color, LZW compression. They were appearing in the PDF as grey scale. The white background was black, the colors were various grey scale. Yuuch!
I discovered that the TIF images had to be 24 bit color before they would appear correctly. Problem Solved. Well, not really. This lead to another problem.
The AddImageFromFile() call was very slow!! The images I was using for testing was ~ 1000 x 1000 dots, 125 DPI, roughly one letter or A4 page. Nothing huge. 150k on disk. The call was taking 5-10 seconds to complete!
8 bit files were much faster. under 1 second. But I could not use them due to the color issue
I even tried using variant arrays to initially store the image (my image handling control has this function), then use qp.AddImageFromVariant() in an attempt to speed up the call. It was actually slightly slower if anything....
So the trial and error continued. I tried other formats. JPEG files (native 24bit) did not work at all, I would get errors opening the pdf'.s "Insufficient data for an image" and the files were obviously too small (2k) suggesting correct conversion in the file).
In the end, bitmap (bmp) files were the answer. The same image, as 24 bit BMP files, take under 1 second to load using AddImageFromFile()
Hope this helps someone in the future. After all the questions regarding image handling, I'm especially happy to have this working and to share what I have learned.
Cheers!
Jim
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Jim!
Thanks for your detailed help! Postings like yours are quite seldom here. Welcome and best regards, Ingo |
|
![]() |
|
Michel_K17 ![]() Newbie ![]() ![]() www.exp-systems.com Joined: 25 Jan 03 Status: Offline Points: 297 |
![]() ![]() ![]() ![]() ![]() |
Wow... good info: thank you for sharing. Sounds like QuickPDF has a lot of image handling issues. I imagine then that the best bet is to use a separate image library in VB6 to import a TIF/JPG etc. , convert to BMP either in memory, or to a file, and then import into the PDF?
What a shame. |
|
Michel
|
|
![]() |
|
Francesco ![]() Beginner ![]() Joined: 26 Sep 07 Location: Italy Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
Is not a good idea to export TIF/JPG images as BMP and then import this in the PDF as in this case you will loose original compression ! For example, if you have a TIF file with an A4 bitonal page compressed as G4, and the files size is 50 Kb, if you will import directly from TIF then the PDF created will have about the same size, while if you export to BMP then the PDF created will be about 1000 Kb. Also if you enable the image compression, the file will be compressed using "deflate" algo (not G4) and the image will still be 200/300 kb...
Francesco
|
|
![]() |
|
StarSteve ![]() Beginner ![]() ![]() Joined: 07 Nov 05 Location: Germany Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Hi All, hmm... very strange this image (esp. TIF/JPEG) problems weren't in version 4.41.1.1 (21.12.2004), but indeed in version 5.22.0.145 (01.03.2007). Also, the SaveImageToFile doesn't work with TIF/JPEG (anymore)
see sample (in v5.22 all corrupted, missing images are 24bit JPEG):
v.4.41= NO PROB: http://astroworld.net/DEV/samples/v41.pdf
v.5.22= BIG PROB: http://astroworld.net/DEV/samples/v52.pdf
I guess, accidently something was changed in the code to no good
![]() Q2Proggers: any idea ?
please solve, if possible...
![]() cu Stefan
|
|
![]() |
|
StarSteve ![]() Beginner ![]() ![]() Joined: 07 Nov 05 Location: Germany Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
some add.notes to the above : v4.41 (24.12.2004) = OK
v4.42 (01.04.2005) = OK v5.13 (08.01.2006) = OK v5.14 (11.02.2006) = OK v5.20 RC1 (20.11.2006) = OK v5.20 RC2 (05.12.2006) = OK v5.21 (28.12.2006) = OK v5.22 (01.03.2007) = ERROR since the s.c for v5.22 wasn't published yet, I can't check/review it myself
![]() but Michel could you plz do
![]() cheers Stefan
|
|
![]() |
|
Michel_K17 ![]() Newbie ![]() ![]() www.exp-systems.com Joined: 25 Jan 03 Status: Offline Points: 297 |
![]() ![]() ![]() ![]() ![]() |
Sorry. v5.22 Source code is in the hands of Marian who authored the changes and he is not making it available. We have discussed this at length and part of the problem is that Marian cannot work on the library for free. Nonetheless, I do know that Marian is pretty flexible and willing to help. Try sending him an e-mail at support[at]quickpdf[dot]org. Maybe he will be able to take a look and perhaps fix.
Cheers! |
|
Michel
|
|
![]() |
|
StarSteve ![]() Beginner ![]() ![]() Joined: 07 Nov 05 Location: Germany Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
thx mate :)
I 'll do so asap - cheers Stefan
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store