Link Search Menu Expand Document

Using PDF Extractor SDK from Delphi

Some Delphi versions are incorrectly working with .NET - ActiveX wrappers directly but works fine through the so called “late binding” which do NOT require to have anything imported or added (so remove the PDFExtractor… tlb file form the project).

Here is the sample DPR code:

program Project1;

{$APPTYPE CONSOLE}

{

IMPORTANT:

To work with Bytescout PDF Extractor SDK you may also use Late Binding

}

uses

SysUtils,

ActiveX;

var

extractor: Variant;

begin

CoInitialize(nil);

// Create Bytescout.PDFExtractor.CSVExtractor object using CoCSVExtractor class

extractor := CreateOleObject(‘Bytescout.PDFExtractor.CSVExtractor’) ;


extractor.RegistrationName := ‘demo’;

extractor.RegistrationKey := ‘demo’;

// Load sample PDF document

extractor.LoadDocumentFromFile (‘../../sample3.pdf’);

// extractor.CSVSeparatorSymbol = ‘,’; // you can change CSV separator symbol (if needed) from “,” symbol to another if needed for non-US locales

extractor.SaveCSVToFile (‘output.csv’);

// destroy the extractor object

extractor := nil;

end.