Hola de nuevo,
Estoy intentando implementar el codigo de bucanero, pero me da error en la llamada.
Código Delphi
[-]
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
public
function GetPDFPageCount(const FileName:PWideChar):LongInt; stdcall;
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;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.Button1Click(Sender: TObject);
var
filename:string;
texto:string;
begin
if opendialog1.Execute then
begin
filename:=opendialog1.FileName;
texto:=GetPdfText(PWideChar(FileName));
end;
end;
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';
end.
Cita:
unit1.pas(58,44) Error: Incompatible types: got "ShortInt" expected "PWideChar"
|
También busqué en el ejemplo de la propia dll pero lo maneja un poco diferente.