Hi and thnk you/
So far no improvment.
Here is what I have now :
procedure Tmain1.BtnExportutuClick(Sender: TObject);
var
typerech, compression : integer;
FileName, PDf_TIT: string;
i, p: integer;
bmp : tiebitmap;
iev:TIEVisionSearchablePDFGenerator;
IEBitmap : TIEVisionImage ;
newfilename, fichier : string;
TheList : TStringlist;
langPath: string;
langCode: string;
old_CurrentDir : string;
begin
//https://www.imageen.com/help/index.php?topic=TIEVisionSearchablePDFGenerator&m=2
// (Size: iepA4; Name: 'A4'; Width: 595; Height: 842),
// ImageEnView2: TImageEnDBView;
// ImageEnView1: TImageEnMView;
{
in to formCreate :
fDBMBitmap : TIEDBMultiBitmap;
fDBBitmap : TIEDBBitmap;
ImageEnView1.SetModernStyling;
fDBMBitmap := TIEDBMultiBitmap.create( udm1.DS_fi_Img , '', 'CHEMIN_CPL', dmAllRecords ); //The file name is complete in field CHEMIN_CPL
CHEMIN_CPL is like '\\C5\G\GHSC\F-ZBPA\NI 000007\BV 050H\0_20230421143226408_000244.JPG'
fDBMBitmap.ImagePath := '';
fDBMBitmap.FollowDBCursor := True;
fDBMBitmap.AutoLoad := true;
fDBMBitmap.mode := dmAllRecords ;
ImageEnView1.SetExternalMBitmap( fDBMBitmap );
imageEnView1.DefaultTopText := iedtCustom;
}
old_CurrentDir := GetCurrentdir ;
FwaitForm.wait(true);
try
if ImageEnView1.ImageCount > 0 then
begin
langCode := string(IEVisionLanguageNameToCode(IEOCRLanguageList[OCR_English_language].DisplayName));
langPath := IncludeTrailingBackSlash(ExtractFilePath(Application.ExeName));
if LanguageExistsInFolder(langCode, langPath) then
begin
SetCurrentDir( langPath );
langPath := ''; // Language is in current path (support for paths with non-ansi characters)
end
else
begin
ShowMessage(' Language is in current path (support for paths with non-ansi characters) : not found');
Exit;
end;
JvSaveDialog1.FileName := udm1.fi_Img.FieldByName('REG').AsString+'-'+udm1.fi_Img.FieldByName('CHECKS_NUMBER').AsString+'-'+udm1.fi_Img.FieldByName('WORK_ORDER').AsString+'.pdf';
JvSaveDialog1.Execute;
FileName := JvSaveDialog1.FileName;
if FileName <> '' then
begin
ShowTempHourglass();
PDf_TIT := udm1.fi_Img.FieldByName('REG').AsString+' - '+udm1.fi_Img.FieldByName('CHECKS_NUMBER').AsString+' - '+udm1.fi_Img.FieldByName('WORK_ORDER').AsString ;
iev := IEVisionLib.createSearchablePDFGenerator(PAnsiChar(AnsiString(langPath)), PAnsiChar(AnsiString(langCode)) );
iev.beginDocument( PWideChar( FileName ), PAnsiChar(AnsiString(PDf_TIT )));
if length(ImageEnView1.MultiSelectedImagesList) = 0 then
ImageEnView1.SelectAll;
if ImageEnView1.ImageCount > 1 then
begin
TheList := TStringlist.Create;
for i :=0 to length(ImageEnView1.MultiSelectedImagesList)-1 do
begin
if fileexists(ImageEnView1.ImageFileName[ImageEnView1.MultiSelectedImages[i]]) then
TheList.Add('File found ' + ImageEnView1.ImageFileName[ImageEnView1.MultiSelectedImages[i]] )
else
TheList.Add('File not found ' + ImageEnView1.ImageFileName[ImageEnView1.MultiSelectedImages[i]] );
end;
for i :=0 to length(ImageEnView1.MultiSelectedImagesList) -1 do
begin
if fileexists(ImageEnView1.ImageFileName[ImageEnView1.MultiSelectedImages[i]]) then
begin
ImageEnView1.SelectedImage := i;
Application.ProcessMessages;
IEBitmap := ImageEnView1.IEBitmap.GetIEVisionImage();
iev.addPage(IEBitmap, ievPDFImgFmt_AUTO) ;
if cxMemo1.Visible then
cxMemo1.lines.Add(ImageEnView1.ImageFileName[ImageEnView1.MultiSelectedImages[i]] );
end;
end;
iev.endDocument();
iev := nil;
TheList.Free;
end;
end;
end
else
showmessage('no image displayed');
application.processmessages;
except
on E: Exception do
begin
if E is EAccessViolation then
MessageDlg('An error was encountered processing this image. Ensure you are using the latest version of the IEVision plug-in.'+e.message+rc+TheList.text, mtError, [mbOK], 0)
else
MessageDlg('An error was encountered processing this image: ' + e.message, mtError, [mbOK], 0);
end;
end;
SetCurrentDir(old_CurrentDir);
FwaitForm.wait(False);
end;