ImageEn, unit ievision

TIEVisionLibrary.createSearchablePDFGenerator

TIEVisionLibrary.createSearchablePDFGenerator


Declaration

function createSearchablePDFGenerator(path: PAnsiChar; language: PAnsiChar; engine: TIEVisionOCREngine = ievOCRDefault): TIEVisionSearchablePDFGenerator; safecall;


Description

Create a SearchablePDFGenerator object for the specified language. A SearchablePDFGenerator allows you to create a multipage PDF from a set of images. OCR is performed on the images so the PDF will be searchable (and the text can be selected and copied).

Many languages are available as separate files.

Parameter Description
path Folder containing language data (*.TrainedData) files. If a path is not specified the Windows current directory is assumed
language Language code of OCR recognition (e.g. 'eng', 'fra'). To use multiple languages, separate them with the plus character, e.g. 'chi_sim+eng' (Simplfied Chinese and English) or 'eng+fra+deu' (English, French and German)
engine OCR engine to use

Note:
A shortcut method for this is available: CreateSearchablePDF
To avoid specifying a path for the language file, call SetCurrentDir() with the language path


Demos

Demo  Demos\IEVision\GenerateSearchablePDF\GenerateSearchablePDF.dpr


Example

// Create a textual PDF named 'out.pdf' from the content of ImageEnMView1 using OCR
pdfGen := IEVisionLib.createSearchablePDFGenerator('./', IEOCRLanguageList[OCR_English_language].Code);
pdfGen.beginDocument(PAnsiChar(AnsiString(langPath + 'out')), PAnsiChar(AnsiString('title')));
for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
  ImageEnMView1.SelectedImage := i; // Show the image being processed
  pdfGen.addPage(ImageEnMView1.IEBitmap.GetIEVisionImage());
end;
pdfGen.endDocument();

// Create generator for English, French and German
pdfGen := IEVisionLib.createSearchablePDFGenerator('./', IEOCRLanguageList[OCR_English_language].Code + '+' +
                                                         IEOCRLanguageList[OCR_French_language].Code + '+' +
                                                         IEOCRLanguageList[OCR_German_language].Code + '+' );
...


See Also

TIEVisionSearchablePDFGenerator