Si la aplicación es bajo windows puedes utilizar la dll PDFText, que puedes encontrar en este enlace:
https://pdf-analyzer.com/mdownloads.html, yo la utilizo para extraer información de los PDF y funciona bien.
Aquí dejo el código de uso de esta DLL
Código Delphi
[-]
type
TPDFText = class
public
function GetPDFNumPages(const FileName:string):LongInt; overload;
function GetPDFContent(fileName: string): string;
function GetPDFErrorMsg(const CodeError: Integer): string;
end;
implementation
uses System.SysUtils;
function GetPDFPageCount(const FileName:PWideChar):LongInt; stdcall; external 'PDFtext.dll';
function GetPDFText(const FileName: PWideChar;
opt: LongInt=3;
hw: LongInt=0;
fast: LongInt=0;
target: PWideChar=0;
lspaces: LongInt=1;
ptitel: PWideChar=0;
pos: LongInt=0;
page: LongInt=0;
clock: LongInt=0;
blank: LongInt=0;
ende: LongInt=0;
wlist: LongInt=0): pWidechar; stdcall; external 'PDFtext.dll';
function TPDFText.GetPDFErrorMsg(const CodeError: Integer): string;
begin
case CodeError of
0:
result := 'General main error';
9001:
result := 'File not found';
9002:
result := 'No PDF file';
9003:
result := 'There´s a user password';
9004:
result := 'Invalid/damaged page structure';
9005:
result := 'Target drive/path is not valid';
9006:
result := 'Target drive/path is missing';
9007:
result := 'Source and target (for fileoutput) is the same';
9015:
result := 'The text is based on the rare codepage 1251.. extraction won''t work proper';
9016:
result := 'The text is based on the codepage CJK... extraction wont''t work proper';
else
result := 'Unknow error';
end;
end;
function TPDFText.GetPDFNumPages(const FileName: string): LongInt;
begin
result := GetPDFPageCount(PWideChar(FileName));
end;
function TPDFText.GetPDFContent(fileName: string): string;
var
errorCode: integer;
begin
result := GetPdfText(PWideChar(fileName));
if (Length(result) <= 4) and TryStrToInt(result, errorCode) then
result := GetPDFErrorMsg(errorCode);
end;
y para llamar a la clase:
Código Delphi
[-]
uses PDFtext;
procedure TForm2.Button1Click(Sender: TObject);
var
PDFText: TPDFText;
begin
with OpenDialog1 do
if execute then begin
PDFText := TPDFText.Create;
try
memo1.lines.add(Format('%d pagina/s', [PDFText.GetPDFNumPages(filename)]));
memo1.lines.add(Format('contenido:'#13'%s', [PDFText.GetPDFContent(filename)]));
finally
PDFText.Free;
end;
end;
end;
Los inconvenientes de este sistema son:
-La información obtenida del PDF no va en el mismo orden que se ve en el documento, aunque esto no es problema de la DLL si no mas bien de como está organizado el PDF internamente
-Y la DLL en su versión freeware, después de leer el PDF muestra una ventana con la información del autor
saludos