InjectTextLayer Method of the Engine Object

This method processes the input "image only" or "image on text" PDF file and creates a searchable PDF file which contains the same page images and the invisible text layer created from the recognized text of the document.

Please note that if the input file already contains a text layer, it will be replaced. You can use the IsPdfWithTextualContent method of the Engine object to check if the input file contains a text layer.

Only PDF files can be processed using this method. To create searchable PDFs from other image types, you can use methods of the FRDocument object (e.g., AddImageFile, Process, and Export).

Note: The COM library must be initialized on the current thread before calling this method.

Syntax

C++

HRESULT InjectTextLayer(
  BSTR                       SourcePdfFile,
  BSTR                       TargetPdfFile,
  IImagePasswordCallback*    PasswordCallback,
  IPrepareImageMode*         PrepareMode,
  IDocumentProcessingParams* DocumentProcessingParams,
  IIntsCollection*           PageIndices,
  IProcessingEvents*         ProcessingEvents,
  ITextLayerInjectionParams* TextLayerInjectionParams
);
    

C#

void InjectTextLayer(
  string                    SourcePdfFile,
  string                    TargetPdfFile,
  IImagePasswordCallback    PasswordCallback,
  IPrepareImageMode         PrepareMode,
  IDocumentProcessingParams DocumentProcessingParams,
  IIntsCollection           PageIndices,
  IProcessingEvents         ProcessingEvents,
  ITextLayerInjectionParams TextLayerInjectionParams
);
    

Visual Basic .NET

 Sub InjectTextLayer( _
  SourcePdfFile As String, _
  TargetPdfFile As String, _                
  [PasswordCallback As IImagePasswordCallback = Nothing], _
  [PrepareMode As IPrepareImageMode = Nothing], _         
  [DocumentProcessingParams As IDocumentProcessingParams = Nothing], _
  [PageIndices As IIntsCollection = Nothing], _
  [ProcessingEvents As IProcessingEvents = Nothing], _
  [TextLayerInjectionParams As ITextLayerInjectionParams = Nothing] _
)
    

Parameters

SourcePdfFile
[in] This variable contains the full path to the source PDF file. Files in other formats cannot be processed.
TargetPdfFile
[in] This variable contains the full path to the searchable PDF file which must be created as a result of processing. The names of source and target files cannot be the same.
PasswordCallback
[in] Refers to the interface of the user-implemented object of the type IImagePasswordCallback which is used to handle possible password requests for accessing PDF files. This parameter is optional and may be 0 in which case password-protected files cannot be processed.
PrepareMode
[in]  Refers to the PrepareImageMode object that defines the mode of converting the image file into ABBYY FineReader Engine internal format. This parameter may be 0 in which case the default parameters of the image preparation mode are used, or, if a profile has been loaded, the parameters set by this profile are used.
Please note that of the parameters corresponding to geometry correction, only those corresponding to deskewing, mirroring and rotation are taken into account. Page splitting and nonlinear geometry correction are not performed.
DocumentProcessingParams
[in] Refers to the DocumentProcessingParams object that stores all processing parameters. This parameter may be 0. In this case, the document is processed with default parameters (all processing parameters are set to default values), or, if a profile has been loaded, the parameters set by this profile are used.
Please note that of the parameters corresponding to geometry correction, only those corresponding to image deskewing, mirroring and rotation are taken into account. Page splitting and nonlinear geometry correction are not performed.
PageIndices
[in] This parameter refers to the IntsCollection object which specifies the indices of the document pages, to which the text will be injected. This parameter is optional and may be 0, in which case the text will be injected to all the pages of the document.
ProcessingEvents
[in] Refers to the IProcessingEvents interface of the user-implemented object which is used to manage processing. This parameter may be 0, in which case no callback will be attached.
TextLayerInjectionParams
[in] This variable refers to the TextLayerInjectionParams object that stores parameters of document processing during the text injection. This parameter may be 0. In this case, the default values of the object properties are used.

Return values

This method has no specific return values. It returns the standard return values of ABBYY FineReader Engine functions.

Remarks

The processing parameters which correspond to image deskewing, mirroring and rotation are taken into account. Page splitting and nonlinear geometry correction are not performed.

Depending on the value of the IEngine::MultiProcessingParams property, ABBYY FineReader Engine can distribute processing of multi-page documents to CPU cores.

See also

Engine

IImagePasswordCallback

24.03.2023 8:51:52

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.