Print Page | Close Window

Hangs up using TIF!

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=397
Printed Date: 10 May 24 at 5:23PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Hangs up using TIF!
Posted By: kukulkan
Subject: Hangs up using TIF!
Date Posted: 25 Apr 06 at 8:09AM
Hi,

I try to convert a multipage TIFF into a PDF using QuickPDF (V5.14 ActiveX-Version). Here is the code (parts):

Private Sub DoBitmap()
      Dim PDF As New iSED.QuickPDF
      Dim x As Long
      Dim Dat As String
      Dim cErr As Long
      Dim Erg As Long
      Dim parFilename As String
      Dim E As Long
      
      parFilename = "c:\TestDokument.tif"
    
      PDF.UnlockKey "xxxxxxxxxxxxxx"
      PDF.SetOrigin 1 ' //To top left
      PDF.SetMeasurementUnits 1 ' //means millimetres
      PDF.SetPageSize "A4"      '      

      ' insert all tiff-pages to pdf-pages
      x = 0: Erg = 1
      While Erg <> 0
          x = x + 1
          If x > 1 Then PDF.NewPage
          Erg = PDF.AddTIFFImageFromFile(parFilename, x)
          If Erg <> 0 Then
              E = PDF.DrawImage(0, 0, PDF.PageWidth, PDF.PageHeight)
          End If
      Wend
      PDF.CompressContent
      PDF.SaveToFile "c:\Test.pdf"
End Sub


Using this picture (only for example. I have lots of other pictures that don't work) hangs up using 100%. It hangs on the first call of PDF.AddTIFFImageFromFile() with correct parameters (good filename and x=1).

Here is the picture: picture with about 600KB and two pages. [EDIT] removed link on 27 Apr 2006[/EDIT]

Please, can someone help me? Using JPG works fine (one page documents)!

Kukulkan



Replies:
Posted By: chicks
Date Posted: 25 Apr 06 at 11:45AM
Haven't tried your tiff, but a possible workaround is to convert your tiff files to PDF first, then import them with QuickPDF. Here's a freeware tiff2pdf converter:

http://www.dreamsyssoft.com/tiff-to-pdf/


Posted By: kukulkan
Date Posted: 26 Apr 06 at 3:42AM
Hi chicks,

Thank you, but I chose QuickPDF because I don't need any other dll's or programs to do my job. Now, the TIF's can't get imported. tiff2pdf is only free for freeware-products. I need it for a commercial project.

Can someone look at my code above and use my tiff to reproduce the error? Maybe someone of the code-specialists can fix the problem?

Is it possible to add a bitmap to a PDF using it's hDC or Handle? This would help in my case...

Kukulkan


Posted By: Ingo
Date Posted: 26 Apr 06 at 5:31AM
Hi!

I've tried it with AddTIFFImageFromFile...
and it doesn't work, too. I don't have hangups but it lasts a long time (few minutes) and the resulting pdf-file has only 2kb with one blank page. With Foxit i can see it immediately - adobes reader can't make this pdf ready and hang up.

The image looks a bit strange... ;-) Perhaps you should ask how the relevant images were created?

Good luck!

Best regards,
Ingo



Posted By: Ingo
Date Posted: 26 Apr 06 at 5:43AM
Hi Kukulkan!

I've found the problem! The tif is lzw-compressed. I've opened it with IrfanView and have saved each of the two pages as tif without lzw-compression.

This new tifs i could generate to pdf quickly. Then merging and i have the new pdf.

BTW: The tifs without lzw-compression are smaller then the one with compression ;-)

Best regards,
Ingo

Achja... Vielleicht solltest Du Dokumente dieser Art nicht einfach so ins Netz stellen...?


Posted By: kukulkan
Date Posted: 26 Apr 06 at 5:46AM
Hi Ingo,

Thank you for your test. So it is not only my system with this problems. The image is not good, I know (it is a converted one). But the content doesn't mather here. Programs like ACDSee, Windows Imaging, Leadtools, QuickView and others can open this picture without problems. So it is definitive a bug in QuickPDF.

Is it possible to add image if I have an ImageDC or BitmapDC? This will be the only way I can handle this problem (if no one of the programmers will fix the bug).

[EDIT]Hi Ingo, thank you, but the pictures are scanned by a customer of mine and I dont have the possibility to change the format (it is an archive of 10 years).

PS. Das ist ein Spass-Text der als Gag durchs Internet ging...

Kukulkan


Posted By: Ingo
Date Posted: 26 Apr 06 at 7:19AM
Hi again ;-)

...but you can use a small tif2jpg-component... converting the jpgs to single pdf-pages... and then merge...
Not a short way... but as a workaround... ;-)

Best regards,
Ingo


Posted By: chicks
Date Posted: 26 Apr 06 at 12:59PM
kukulkan,

OK, downloaded your Tiff, and was able to convert it to jpg and bmp using the GDI+ API (available on Win2K and above by default, can be installed on '95 & '98) using this example:

http://www.powerbasic.com/support/forums/Forum7/HTML/002273.html

The example only does the first page, you'll need to dig into the API to do multiple pages.

Here's a compiled version of the converter for testing:

http://www.geocities.com/sea_sbs/files/gditools.zip

Note that it has a funky argument format, expecting commas between input and output paths.

Note further that AddTIFFImageFromFile() has been deprecated, should be using AddImageFromFile() instead.

Another free Tiff library is here:

http://www.libtiff.org/

It includes a bunch of tools, including one that converts multi-page Tiffs to PDFs. I have compiled it under MSYS/MinGW to Windows .exe format, but the tools are also available in compiled form. There is probably a DLL version available out there, as well.


Posted By: kukulkan
Date Posted: 27 Apr 06 at 2:14AM
Hi chicks,

Thank you for your effort. I searched, which library's my customer has around on his systems and found freeimage-library (for another application) which is able to load theese images, too. So I load the images using freeimage and save them as JPG to add to the PDF-file (all in one loop). GDI+ would be nice, too. But the customer uses a lot of NT4 systems and I don't know if GDI+ is available on all his systems.

Thank you again, but is it a general problem using LZW coded TIF-files together with QuickPDF?

Kukulkan



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk