Print Page | Close Window

Converting Tif to PDF

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=976
Printed Date: 09 Jul 25 at 12:21PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Converting Tif to PDF
Posted By: rgoodson
Subject: Converting Tif to PDF
Date Posted: 10 Oct 08 at 9:07PM
Hello,
 
I am trying to convert a single-page tif to a pdf. Everytime I try it, it creates a document with a one-page blank document. I am using version 5.22.0.145 (although I have noticed than in the References section of VB6, it is listed as iSEDQuickPDF 5.20).
 
My code is as follows:
 
Dim QP As iSED.QuickPDF
Dim ImageID As Long
    
Set QP = CreateObject("iSED.QuickPDF")
Call QP.UnlockKey("my evaluation code")
Call QP.NewDocument
ImageID = QP.AddImageFromFile("c:\test.tif", 0)
Call QP.DrawImage(0, 0, 612, 792)
QP.SaveToFile ("c:\output.pdf")
 
Can you tell what I am doing wrong?
 
 



Replies:
Posted By: Ingo
Date Posted: 11 Oct 08 at 4:03PM
Hi!
 
TIFs can have more than one page - So you have to insert the pagenumber you want to add. If you want page 1 ('cause there's only page 1 then insert 1). For all other imagetypes this parameter should be always 0 - for TIFs this parameter should be 1 or any other pagenumber but not 0.
 
Best regards and welcome here,
Ingo
 


Posted By: rgoodson
Date Posted: 12 Oct 08 at 12:16PM
Hello,
 
I tried changing the 0 to 1, but the resulting pdf is still blank. I did notice that if I change tif files that I am using to import, the size of the pdf file is changed, so apparently something is being done to the pdf file based on the tif file imported, its just not be displayed. Is there some finalize setting or something I need to do?
 
Here is my revised code:
 
Dim QP As iSED.QuickPDF
Dim ImageID As Long
    
Set QP = CreateObject("iSED.QuickPDF")
Call QP.UnlockKey("my eval license code")
Call QP.NewDocument
ImageID = QP.AddImageFromFile("c:\test.tif", 1)
Call QP.DrawImage(0, 0, 612, 792)
QP.SaveToFile ("c:\output.pdf")
    
Set QP = Nothing


Posted By: Ingo
Date Posted: 13 Oct 08 at 2:09AM
Hi,

i've used the search-function (above) and found this code-part:

// . . .

  QP := TiSEDQuickPDF.Create;
  try
    QP.UnlockKey(PDF_Unlock_Key);
    DocID := QP.NewDocument ;
    QP.SelectDocument(DocID) ;
    QP.SelectPage(1) ;
    ImageID := QP.AddImageFromFile(ImageFileName, 0) ;
    QP.SelectImage(ImageID) ;
    if (QP.ImageWidth  > QP.PageWidth)  or
       (QP.ImageHeight > QP.PageHeight) then
       begin
          W := QP.PageWidth ;
          H := QP.PageHeight ;
       end
      else
       begin
          W := QP.ImageWidth ;
          H := QP.ImageHeight ;
       end ;
    QP.FitImage(1, QP.PageHeight-80, W, H, 1, 1, 0) ;
    QP.SaveToFile(ChangeFileExt(ImageFileName, '.pdf')) ;
  finally
     QP.Free ;
  end ;

// . . .

Best regards,
Ingo



Posted By: rgoodson
Date Posted: 13 Oct 08 at 11:05AM

Thank you for your help. This method worked great.

By the way, is there an event handler that will let you know when the pdf creation has been finished? I can look at the functions at this link: http://web.archive.org/web/20040803091539/www.sedtech.com/isedquickpdf/?page=functions - http://web.archive.org/web/20040803091539/www.sedtech.com/isedquickpdf/?page=functions , but I do not see anything about Events or Properties.



Posted By: Ingo
Date Posted: 14 Oct 08 at 1:40AM
Hi!
I don't know detailed what you're meaning ...
It's a problem if pdf-creation lasts very long 'cause there are no options for showing progress. But this should be no problem if you're always using syntax like "try...finally...".
Best regards,
Ingo



Posted By: rgoodson
Date Posted: 14 Oct 08 at 6:59PM
Ok. I understand now. I didn't realize that the program stopped execution until the SaveAsFile function was completed, and that the function returns a value letting you know if the file was created successfully or not. I have everything working properly now. Thank you for your help.
 
Reagan



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