Using the Component
Installing XpdfImageExtract
Before using the XpdfImageExtract 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 XpdfImageExtract.dll
Referencing XpdfImageExtract
To use the XpdfImageExtract 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 XpdfImageExtract.Instantiating an XpdfImageExtract Object
The code needed to instantiate an XpdfImageExtract object depends on your development environment. In VB6:Dim pdf As XpdfImageExtract.XpdfImageExtract
Set pdf = New XpdfImageExtract.XpdfImageExtract
In ASP VBScript:
Set pdf = Server.CreateObject("Xpdf.XpdfImageExtract")
In VB.net:
Dim pdf As XpdfImageExtract.XpdfImageExtract
pdf = New XpdfImageExtract.XpdfImageExtract()
In C#:
XpdfImageExtract.XpdfImageExtract pdf;
pdf = new XpdfImageExtract.XpdfImageExtract();
In Delphi:
var
pdf: IXpdfImageExtract;
begin
pdf := CoXpdfImageExtract_.Create;
Working with XpdfImageExtract
Once you've instantiated an XpdfImageExtract object, you can load PDF files and retrieve metadata. Typical code looks like this:Dim mask As Long, colorSpace As Long, w As Long, h As Long
pdf.loadFile "c:/test/file.pdf"
' extract images on page 1
pdf.getImages 1
n = pdf.getNumImages
For i = 0 To n-1
pdf.getImageInfo i, mask, colorSpace, w, h
....
Next i