Print Page | Close Window

Multipage TIFF 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=426
Printed Date: 24 May 24 at 10:45PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Multipage TIFF to PDF
Posted By: Squid
Subject: Multipage TIFF to PDF
Date Posted: 04 Jun 06 at 11:59AM
I am trying to to use the
Function AddTIFFImageFromFile(FileName,Page);

I am using Delphi 6 and 5.13 evaluation version.
I have two problems:

1. No matter what value I enter for Page the first image in the TIFF file is added.

2. The return value from the function is high and inconsistent.

Any help appreciated.

Squid



Replies:
Posted By: JanN
Date Posted: 05 Jun 06 at 8:12AM
Originally posted by Squid Squid wrote:

2. The return value from the function is high and inconsistent.

The ImageID is returned which can be passed to functions like SelectImage and DrawImage. So the return value is OK.

What does the function GetImagePageCount return?


Posted By: Squid
Date Posted: 05 Jun 06 at 11:27AM

The function GetImagePageCount returns 5 (the correct number of pages for the TIFF file).

Here is some sample code. 

procedure TfmControl.btnPDF1Click(Sender: TObject);
  var
   QP : TiSEDQuickPDF;
   i,j  : Integer;
  begin
   QP := TiSEDQuickPDF.Create;
   try
     QP.UnlockKey('eval_code_key_here');
     QP.SetOrigin(1);
     QP.SetMeasurementUnits(1);
     QP.SetPageDimensions(210, 297);
     QP.NewPages(5);

     for i := 1 to QP.PageCount do begin
       QP.SelectPage(i);
       j := QP.AddTIFFImageFromFile('5pageTIFF.tif',i);
       ShowMessage('Image Added '+ IntToStr(j));

//       QP.SelectImage(i);  ....... see note below
//       QP.SelectImage(j);  ....... see note below
       j := QP.SelectedImage;
       ShowMessage('Selected Image '+ IntToStr(j));

       j := QP.DrawImage(0, 0, 210, 297);
       ShowMessage('Image Drawn '+ IntToStr(j));

       j := QP.ImageCount;
       ShowMessage('Image Count '+ IntToStr(j));
     end;

     QP.SaveToFile('test.pdf');
   finally
     QP.Free;
   end;
  end;

Notes:

1. The lines that have been remmed out have no effect if they are reinstated!

2. There are 5 images in the file.  I deleberately let it loop 6 times.  Shouldn't AddTIFFImageFromFile return a 0 on the last loop?

3. Typical values for image added are 16439460, 17321532,16932724, 26569308, 27535904, 27254720.  If you run the code again you get different values.

4. Selected Image always matches the image added value (with or without the remmed code).

5. Image drawn is always 1.

6. Image count matches the loop count.

7. There is no parameter by which I can pass ImageID to DrawImage.

 

Squid

 

 

 



Posted By: DELBEKE
Date Posted: 06 Jun 06 at 1:36AM

The value returned bu AddImageFormFile is a handle to the loadedimage, A zero value says the laod has failed.

You can use this value in the selectimage function

Ex : (using VB)

Qp.SelectPage(MyTiffPageNumber)

hImageId=Qp.AddImageFormFile(MyTiffFileName,MyTiffPageNumber)

if hImageId=0 then

  msgBox "Error . Ca'nt read the Tiff FIle"

end if

Qp.SelectImage(hImageId) 

Qp.DrawImage 0,0,210,297

 

Hope this help

 




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