Algorithm Math Delphi

Title: How to convert TIF to PDF
Question: You have a multipage TIF file, that you want to convert to a PDF file.
How do you do that?
Answer:
To use this function, you need a full license/version of Adobe Acrobat. I've tested this function with Adobe Acrobat 4.0.
First you need to import the Acrobat AxtiveX control.
1) Select Component - Import ActiveX Control
2) Select Acrobat Controle for ActiveX and click install
3) Chose a package to install the ActiveX control into
4) Put PDFlib_tlb in your uses clauses. The file is in the Borland\Delphi5\Imports directory.
How to use the function
Here's an example of using the function:
if not TifToPDF('c:\test.tif', 'c:\test.pdf') then Showmessage('Could not convert');
The TifToPdf function
function TifToPDF(TIFFilename, PDFFilename: string): boolean;
var
AcroApp : variant;
AVDoc : variant;
PDDoc : variant;
IsSuccess : Boolean;
begin
result := false;
if not fileexists(TIFFilename) then exit;
try
AcroApp := CreateOleObject('AcroExch.App');
AVDoc := CreateOleObject('AcroExch.AVDoc');
AVDoc.Open(TIFFilename, '');
AVDoc := AcroApp.GetActiveDoc;
if AVDoc.IsValid then
begin
PDDoc := AVDoc.GetPDDoc;
PDDoc.SetInfo ('Title', '');
PDDoc.SetInfo ('Author', '');
PDDoc.SetInfo ('Subject', '');
PDDoc.SetInfo ('Keywords', '');
result := PDDoc.Save(1 or 4 or 32, PDFFilename);
PDDoc.Close;
end;
AVDoc.Close(True);
AcroApp.Exit;
finally
VarClear(PDDoc);
VarClear(AVDoc);
VarClear(AcroApp);
end;
end;