How to call PDF to Text SDK from Delphi code?

We just bought  your product PDF2TXT COM with Developer License. But we can not install the COM into our Delphi 6 environment, which file should I imported it as COM in Delphi 6?
pdf2txt.dll ?  pdf2txtD6.pas?
Please advise, thanks
==========================
Hi,

pdf2txt.dll is a Win32 DLL Library, you needn't import it into Delphi, you can call pdf2txt.dll from your Delphi code directly, please refer to following example source code,

Function pdf2txt(Source: PChar; Destination : PChar) : longint; stdcall; external 'pdf2txt.dll' name 'PDF2TXT';
Function PDF2TXTEx(lpInputPDF: PChar; lpOutTXT: PChar; nFirstPage: Integer; nLastPage: Integer; ownerPWD: PChar; userPWD; PChar): longint; stdcall; external 'pdf2txt.dll' name 'PDF2TXTEx';
procedure PDF2TXTSetLicenseCode(lpRegCode: PChar); stdcall; external 'pdf2txt.dll' name 'PDF2TXTSetLicenseCode';
procedure SetAutoSupportUnicode(bUnicode: boolean) ; stdcall; external 'pdf2txt.dll' name 'SetAutoSupportUnicode';
procedure SetPageSeparator(pszPageSymbol: PChar); stdcall; external 'pdf2txt.dll' name 'SetAutoSupportUnicode';
procedure SetZoomRatio(iZoomRatio: Integer); stdcall; external 'pdf2txt.dll' name 'SetZoomRatio';
procedure SetAutoAddSpace(bAutoAddSpace1: boolean); stdcall; external 'pdf2txt.dll' name 'SetAutoAddSpace';
function SetTXTFormat(bFormatTXTFile: boolean): Integer; stdcall;external 'pdf2txt.dll' name 'SetTXTFormat';
procedure SetOpenResultFile(IsOpen: boolean);  stdcall;external 'pdf2txt.dll' name 'SetOpenResultFile';
procedure SetDeleteBlankLine(IsDelete: boolean); stdcall;external 'pdf2txt.dll' name 'SetDeleteBlankLine';
procedure PDF2TextSetTempPath(nBufferLength: Integer; lpBuffer: PChar); stdcall; external 'pdf2txt.dll' name 'PDF2TextSetTempPath';

procedure TForm1.Button1Click(Sender: TObject);
var
TxtFile : String;
szTempPath: PChar;
begin
// if ok
if open.Execute then
begin

//add later
SetAutoSupportUnicode(FALSE);


// Application exe path and add filename for txt
TxtFile:=ExtractFileDir(ParamStr(0))+'\Temp.Txt';
// Txt file exist ?
If FileExists(TxtFile) then
// ok delete it
DeleteFile(TxtFile);
// convert the file

SetAutoSupportUnicode(false);
//SetPageSeparator("<<<<<<<<<********>>>>>>>>>>>>>");
SetPageSeparator('\f');
SetZoomRatio(100);
SetAutoAddSpace(false);
SetTXTFormat(true);
SetOpenResultFile(true);
SetDeleteBlankLine(true);

szTempPath := 'C:\';

PDF2TextSetTempPath(MAX_PATH, szTempPath);



Pdf2Txt(PChar(open.Filename),PChar(TxtFile));
// open notepad with textfile
ShellExecute(0,'open',PChar(TxtFile),0,0,SW_SHOW);
end;
end;

end.

PDF2TXT SDK package contains a "pdf2txt_delphi6" project, you can also compile and run "pdf2txt_delphi6" project easily.

VeryPDF
VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in PDF to Text Converter and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!