Using the Component
Installing XpdfText
Before using the XpdfText component, it must be registered on your system. Normally the installer will take care of that for you. If you need to register manually, you can run the command:regsvr32 XpdfText.dll
Referencing XpdfText
To use the XpdfText component in a Visual Studio project, select the "References..." command on the "Projects" menu, go to the "COM" tab, and check the box next to XpdfText.Instantiating an XpdfText Object
The code needed to instantiate an XpdfText object depends on your development environment. In VB6:Dim pdf As XpdfText.XpdfText
Set pdf = New XpdfText.XpdfText
In ASP VBScript:
Set pdf = Server.CreateObject("Xpdf.XpdfText")
In VB.net:
Dim pdf As XpdfText.XpdfText
pdf = New XpdfText.XpdfText()
In C#:
XpdfText.XpdfText pdf;
pdf = new XpdfText.XpdfText();
In Delphi:
var
pdf: IXpdfText;
begin
pdf := CoXpdfText_.Create;
Working with XpdfText
Once you've instantiated an XpdfText object, you can load PDF files and convert them to text. Typical code looks like this:pdf.loadFile "c:/test/file.pdf"
n = pdf.numPages
pdf.convertToTextFile 1, n, "file.txt"