Example in VB
Download Now
FAQ'S
Buy It Now
Example
in ASP:
<%
'Create the
object
set pdf2xml = Server.CreateObject("P2TServer.P2T")
'VerifyLicense always success in trial version.
pdf2xml.VerifyLicense "4747457", "345srwr242342423"
'set control flag PDF_OUTPUTRANGE|PDF_OUTPUTPDFINFO,
''%%NUM' is the place holder for page number
pdf2xml.EngageProcessor 64+32,"5,10,11-15",
"#######################%%NUM#########"
Response.Write pdf2xml.Convert ("c:\test\test1.pdf", "c:\box\test1.xml")+
"<br>"
Response.Write pdf2text.Convert ("c:\test\test2.pdf", "c:\box\test2.xml") +
"<br>"
'If you Just wanna output the whole pdf file, you don't need to call
EngageProcessor before
'call Convert
set pdf2xml = Server.CreateObject("P2TServer.P2T")
'VerifyLicense always success in trial version.
pdf2xml.VerifyLicense "4747457", "345srwr242342423"
Response.Write pdf2xml.Convert ("c:\test\test1.pdf", "c:\box\test1.xml")+
"<br>"
%>
Go back to top
Example
in PHP:
<?php
#Create the object
$p2x = new COM("P2TServer.P2T");
#VerifyLicense
always success in trial version.
$p2x->VerifyLicense("4747457", "345srwr242342423");
#set control flag PDF_OUTPUTRANGE|PDF_OUTPUTPDFINFO,
#%%NUM' is the place holder for page number
$p2x->EngageProcessor(64+32,"5,10,11-15",
"#######################%%NUM#########");
print
$p2x->Convert ("c:\test\test1.pdf", "c:\box\test1.xml"). "<br>";
print $p2x->Convert ("c:\test\test2.pdf", "c:\box\test2.xml"). "<br>";
$p2x = null;
?>
Go back to
top
Example in ColdFusion:
<cfobject type="COM"
action="Create"
name="p2x"
class="P2TServer.P2T">
<cfset strName="4747457">
<cfset strKey="345srwr242342423">
<cfset result = p2x.VerifyLicense(strName, strKey)>
<cfset nCtrlFlag=64+32>
<cfset strPageRange="5,10,11-15">
<cfset strPageBreaker="#######################%%NUM#########">
<cfset result=p2x.EngageProcessor(nCtrlFlag, strPageRange, strPageBreaker)>
<cfset strPDFName="C:\test\test1.pdf">
<cfset strTXTName="C:\test\test1.xml">
<cfset result=p2x.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 p2x;
if(p2x.CreateDispatch("P2TServer.P2T"))
{
p2x.VerifyLicense("34234","234234");
p2x.EngageProcessor(0x40 + 0x20,"5,10,11-15",
"#######################%%NUM#########");
CString strRslt = p2x.Convert("C:\\test\\test1.pdf","c:\\test\\test1.xml");
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 myP2X As P2TSERVERLib.P2T
Dim strRslt As String
Set myP2X = New P2T
myP2X.VerifyLicense "234234", "23423432"
myP2X.EngageProcessor 64 + 32, "5,10,11-15",
"#######################%%NUM#########"
strRslt = myP2X.Convert(C:\test\test1.pdf","c:\test\test1.xml")
MsgBox strRslt
'''''''''''''''''''''''''''''''''''''''''''''''''
Go back to top
Any comments or question, Send email to
support@retsinasoftware.com with "P2XDeveloper" 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 bstrXML,
[out, retval] BSTR* pbstrRetVal);
@param BSTR bstrPDF: The absolute path and file name of the pdf file
you
want to convert.
@param BSTR bstrXML: The absolute path and file name of the xml 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