PDF Plain Text
Extractor Server
Edition V4.0(COM)
P2T Server Edition is a
COM component built use high performance ATL
framework, It encapsulates all the functionality into a
COM component and provide an easy to use interface to
upper level application. It can be called from VC/VB/
Delphi/ASP/PHP.... All kind of languages that support
COM.The trial version can only process the first 5 pages
of the pdf document. It will expire 15 days later after
the first use. The trial version will expire if the
system clock was manually adjust
(forward/backward).
>Installation:
Download the 15 days trial version
here.
Unzip the
package to a folder on your hard drive.
Open an dos window and Go to the folder you store P2T
Server Edition.
Run "regsvr32 P2TServer.dll" from command line to
register the component.
Check the methods exposed from the COM
interface here.
>Examples:
Example
in ASP
Example in PHP
Example in ColdFusion
Example in VC
Example in VB
Download Now
FAQ'S Buy
It Now
Example in ASP:
<%
'Create
the object
set pdf2text = Server.CreateObject("P2TServer.P2T")
'VerifyLicense always success in trial version.
pdf2text.VerifyLicense "4747457", "345srwr242342423"
'set control flag PDF_OUTPUTRANGE|PDF_OUTPUTPDFINFO, ''%%NUM'
is the place holder for page number
pdf2text.EngageProcessor 64+32,"5,10,11-15",
"#######################%%NUM#########"
Response.Write pdf2text.Convert ("c:\test\test1.pdf",
"c:\box\test1.txt")+ "<br>"
Response.Write pdf2text.Convert ("c:\test\test2.pdf",
"c:\box\test2.txt") + "<br>"
'If you Just wanna output the whole pdf file, you don't
need to call EngageProcessor before
'call Convert
set pdf2text = Server.CreateObject("P2TServer.P2T")
'VerifyLicense always success in trial version.
pdf2text.VerifyLicense "4747457", "345srwr242342423"
Response.Write pdf2text.Convert ("c:\test\test1.pdf",
"c:\box\test1.txt")+ "<br>"
%>
Go back to top
<?php
#Create the object $p2t = new COM("P2TServer.P2T");
#VerifyLicense always success in trial version.
$p2t->VerifyLicense("4747457", "345srwr242342423");
#set control flag PDF_OUTPUTRANGE|PDF_OUTPUTPDFINFO,
#%%NUM'
is the place holder for page number
$p2t->EngageProcessor(64+32,"5,10,11-15",
"#######################%%NUM#########");
print $p2t->Convert ("c:\test\test1.pdf",
"c:\box\test1.txt"). "<br>";
print $p2t->Convert ("c:\test\test2.pdf",
"c:\box\test2.txt"). "<br>";
$p2t =
null;
?>
Go back to top
Example in ColdFusion: <cfobject type="COM"
action="Create"
name="p2t"
class="P2TServer.P2T">
<cfset strName="4747457"> <cfset strKey="345srwr242342423"> <cfset result = p2t.VerifyLicense(strName, strKey)>
<cfset nCtrlFlag=64+32> <cfset strPageRange="5,10,11-15"> <cfset strPageBreaker="#######################%%NUM#########"> <cfset result=p2t.EngageProcessor(nCtrlFlag, strPageRange, strPageBreaker)>
<cfset strPDFName="C:\test\test1.pdf"> <cfset strTXTName="C:\test\test1.txt"> <cfset result=p2t.Convert(strPDFName, strTXTName)>
Go back to top
Example in VC:
You need generate wrapper class use classwizard first.
"ClassWizard->ActiveX Events->Add Class->From a type
lib..."
////////////////////////////////
IP2T p2t;
if(p2t.CreateDispatch("P2TServer.P2T"))
{
p2t.VerifyLicense("34234","234234");
p2t.EngageProcessor(0x40 + 0x20,"5,10,11-15",
"#######################%%NUM#########");
CString strRslt =
p2t.Convert("C:\\test\\test1.pdf","c:\\test\\test1.txt");
MessageBox(LPCTSTR(strRslt));
}
/////////////////////////////////
Go back to top
Example in VB:
You need to add the reference of P2TServer to the
project
"Project->References..." Make sure "P2TServer Type
Library" was selected there.
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim myP2T As P2TSERVERLib.P2T
Dim strRslt As String
Set myP2T = New P2T
myP2T.VerifyLicense "234234", "23423432"
myP2T.EngageProcessor 64 + 32, "5,10,11-15",
"#######################%%NUM#########"
strRslt =
myP2T.Convert(C:\test\test1.pdf","c:\test\test1.txt")
MsgBox strRslt
'''''''''''''''''''''''''''''''''''''''''''''''''
Go back to top
Any comments or question, Send email to
support@retsinasoftware.com with "P2TServer" in subject.
COM Interface There's 3 methods
exposed
///////////////////////////////////////////////////////
1. HRESULT VerifyLicense(
[in] BSTR bstrName,
[in] BSTR bstrKey,
[out, retval] long* pbRetVal);
VerifyLicense is the method must be called before
all other methods.
It's to verify the run time license information.
@param BSTR bstrName: The register name
@param BSTR bstrKey: The register key code.
@param long* pbRetVal: 1 If verify license
cuccessfully.
0 If something wrong with the name/key
This variable always be set to 1 in trial version
@return S_OK
///////////////////////////////////////////////////////
2. HRESULT EngageProcessor(
[in] int i_CtrlFlag,
[in] BSTR i_bstrPageRange,
[in] BSTR i_bstrPageBreaker);
EngageProcessor is a helper method. It sets the
page range /page breaker
and other control flag for the following converting
process. This function
Don't need to be called if you just want output the
whole pdf file to text
file without any special control.
@param int i_CtrlFlag: The contrl flags you can
pass in to control the
behavior of the PDF Processor.
The CtrlFlag can be the following value or
their's
combination
PDF_OUTPUTPROCESSDETAIL 0x01
PDF_OUTPUTPROCESSTIME 0x10
PDF_OUTPUTRANGE
0x20
PDF_OUTPUTPDFINFO
0x40
PDF_OUTPUTPROCESSDETAIL: Output the detail
information of processing
The output string will be return by pbstrRetVal
in Convert method, See Convert for detail.
PDF_OUTPUTPROCESSTIME: Output the process time
for every pdf file.
The output string will be return by pbstrRetVal
in Convert method, See Convert for detail.
PDF_OUTPUTRANGE: Knowledge the processor only a
subset of pages
need to be output, the page range pass in through
i_bstrPageRange. see i_bstrPageRange.
PDF_OUTPUTPDFINFO: Knowledge the processor to
output the document's
information of current pdf to the beginning of the
output text file.
@param BSTR i_bstrPageRange: The PageRange string
to identify which pages
should be output example: "1,5,2-18,20,23"
This paramter will be check if PDF_OUTPUTRANGE
flag was set.
@param BSTR i_bstrPageBreaker: The string that
seperate each page.
example: "~~~~~~~~~~~~~~~~~~My Document~~~~~Page:
%%NUM~~~~~~~~~~~~~~~~~"
@return S_OK
///////////////////////////////////////////////////////
3. HRESULT Convert(
[in] BSTR bstrPDF,
[in] BSTR bstrTXT,
[out, retval] BSTR* pbstrRetVal);
@param BSTR bstrPDF: The absolute path and file
name of the pdf file you
want to convert.
@param BSTR bstrTXT: The absolute path and file
name of the text file you
want to convert to.
@param BSTR* pbstrRetVal: The result and detail
process/process time information
will return by this pointer(If you set the control flag
in EngageProcessor)
@return S_OK: Process the pdf file successfully. Check *pbstrRetVal
for detail
information.
Go back to top
|