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!
Converting Tif to PDF |
Post Reply |
Author | |
rgoodson
Beginner Joined: 10 Oct 08 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
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?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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
|
|
rgoodson
Beginner Joined: 10 Oct 08 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
|
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
rgoodson
Beginner Joined: 10 Oct 08 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
|
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, but I do not see anything about Events or Properties. Edited by rgoodson - 13 Oct 08 at 4:59PM |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
rgoodson
Beginner Joined: 10 Oct 08 Location: United States Status: Offline Points: 17 |
Post Options
Thanks(0)
|
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
|
|
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