Hi all,
I am trying to convert multiple tif files (multi-page) to pdf. From the seventh file, with about 180KB, all PDF have all pages in tif file but only blank pages.
I appreciate any help, please.
Many thanks in advance.
The code i am using is:
function T_Entrega.RenFilesToPDF(const StartDir: String): Boolean;
var
sr: TSearchRec;
Res: Integer;
_page : SmallInt;
begin
Res := FindFirst(BackSlash(StartDir) + '*.tif', faAnyfile, sr );
if Res = 0 then
try
while res = 0 do begin
if (sr.Attr and faDirectory <> faDirectory) then
with ImageEnView1.IO do begin
Params.PDF_PaperSize := IEStrToPaperSize('A4', iepA4);
Params.PDF_Compression := ioPDF_G4FAX;
CreatePDFFile(BackSlash(DirLotesDest) + ChangeFileExt(sr.name, '.pdf'));
ImageEnView1.Blank;
LoadFromFile(BackSlash(DirLotesDest) + sr.Name);
for _page := 0 to Params.TIFF_ImageCount - 1 do begin
Params.TIFF_ImageIndex := _page;
SaveToPDF;
end;
ClosePDFFile;
end;
ImageEnView1.ClearAll;
Res := FindNext(sr);
end;
finally
FindClose(sr)
end;
Result := True;
end;