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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Lessons learned loading TIF images
  FAQ FAQ  Forum Search   Register Register  Login Login

Lessons learned loading TIF images

 Post Reply Post Reply
Author
Message
JimCanuck View Drop Down
Beginner
Beginner


Joined: 13 Aug 07
Location: Canada
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote JimCanuck Quote  Post ReplyReply Direct Link To This Post Topic: Lessons learned loading TIF images
    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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 16 Aug 07 at 5:21PM
Hi Jim!
Thanks for your detailed help!
Postings like yours are quite seldom here.
Welcome and best regards,
Ingo

Back to Top
Michel_K17 View Drop Down
Newbie
Newbie
Avatar
www.exp-systems.com

Joined: 25 Jan 03
Status: Offline
Points: 297
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michel_K17 Quote  Post ReplyReply Direct Link To This Post Posted: 25 Aug 07 at 10:10AM
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
Back to Top
Francesco View Drop Down
Beginner
Beginner


Joined: 26 Sep 07
Location: Italy
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Francesco Quote  Post ReplyReply Direct Link To This Post Posted: 29 Sep 07 at 8:38AM

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
Back to Top
StarSteve View Drop Down
Beginner
Beginner
Avatar

Joined: 07 Nov 05
Location: Germany
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarSteve Quote  Post ReplyReply Direct Link To This Post Posted: 26 Nov 07 at 8:30PM

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):
 
I guess, accidently something was changed in the code to no good
Q2Proggers: any idea ?
 
please solve, if possible...
 
cu Stefan
Back to Top
StarSteve View Drop Down
Beginner
Beginner
Avatar

Joined: 07 Nov 05
Location: Germany
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarSteve Quote  Post ReplyReply Direct Link To This Post Posted: 26 Nov 07 at 9:21PM

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
Back to Top
Michel_K17 View Drop Down
Newbie
Newbie
Avatar
www.exp-systems.com

Joined: 25 Jan 03
Status: Offline
Points: 297
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michel_K17 Quote  Post ReplyReply Direct Link To This Post Posted: 27 Nov 07 at 12:28AM
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
Back to Top
StarSteve View Drop Down
Beginner
Beginner
Avatar

Joined: 07 Nov 05
Location: Germany
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarSteve Quote  Post ReplyReply Direct Link To This Post Posted: 27 Nov 07 at 9:03AM
thx mate :)
I 'll do so asap - cheers Stefan
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store