PDF2TEXT.COM 

::Convert PDF to Text  ::Developer Edition (DLL)                     

 

Products     Download     Order Online     Support     FAQ   

PDF Plain Text Extractor
Developer Edition V4.0(DLL)

P2T Developer Edition (DLL)  is for software developers who need extreme high performance and well control on the converting process. With P2T DLL Edition, you have the options to output text into a file or set a callback function to get the output text stream in real time manner. The standard DLL architecture make it works more efficient than COM Edition. P2T DLL is also multithread safe. You can integrate it into your own application and redistribute it royalty free.

Check the methods exposed from the DLL here

Examples:

Download Now          FAQ'S            Buy It Now

 

Example in VC:

1. Copy P2TDLL.DLL to the system folder or the folder of your project.

2. Include P2TProcessor.h in your project.

/**
 * This is the callback function. you will get the stream data here.
 * Add your own process logic in the function body.
 * The type of this function is DATACALLBACKFUNC, please check
 * P2TProcessor.h for detail information.
 */
void ContentCallBackFunc(char* i_szStr, int i_size)
{
     char tmp[800]={0};
     _snprintf(tmp,i_size,"%s",i_szStr);
     printf("Content: %s\n",tmp);
}

HINSTANCE hDLL; // Handle to DLL
CREATEPROCESSOR lpCreateProcessor; // Function pointer
RELEASEPROCESSOR lpReleaseProcessor;



hDLL = LoadLibrary("P2TDLL.dll");
if (hDLL != NULL)
{
     lpCreateProcessor = (CREATEPROCESSOR)GetProcAddress(hDLL,
                          "CreateProcessor");
     lpReleaseProcessor = (RELEASEPROCESSOR)GetProcAddress(hDLL,
                          "ReleaseProcessor");

     if (!lpCreateProcessor || !lpReleaseProcessor)
     {
        // handle the error
        MessageBox("Can't locate the function pointer.");
     }
     else
     {
        P2TProcessor* pP2TProcessor = lpCreateProcessor();

        pP2TProcessor->VerifyLicense("Test Me Please", "683690765A89C345B87135F");
        pP2TProcessor->EngagePDFProcessor(0,0,"","");
        pP2TProcessor->ParsePDF("C:\\test\\test.pdf", "C:\\test\\test.txt");
        pP2TProcessor->ParsePDF("C:\\test\\111.pdf",ContentCallBackFunc, 200);
        MessageBox("done!");

                 
                  //The processor must be released before you unload the DLL
        lpReleaseProcessor(pP2TProcessor);
     }

    FreeLibrary(hDLL);
 

Go back to top

 

There's only two method exposed from the DLL.

/**
 * This method get a instance of the processor
 * @return P2TProcessor* The pointer of the new instance of the processor
 */
P2TProcessor* CreateProcessor();
 

/**
 * This method release the instance created by CreateProcessor
 * @param P2TProcessor* i_pP2TP The pointer created by CreateProcessor.
 *
 */
void ReleaseProcessor(P2TProcessor* i_pP2TP);
 

Go back to top

=========>>P2TProcessor.h<<===============
////////////////////////////////////////////////////
#ifndef __P2TPROCESSOR_H_
#define __P2TPROCESSOR_H_

class P2TProcessor;


/**
 * This is the log infromation callback function. if you wanna the real time
 * log/output information, you need hook this function.
 * @param char* i_szStr The input log information.
 *
 */
typedef void(*LOGCALLBACKFUNC)(char* i_szStr);

/**
 * This is the log infromation callback function with context pointer.
 * @param char* i_szStr The input log information.
 * @param void* i_pContext The context pointer pass in ParsePDF.
 *
 */
typedef void(*LOGCALLBACKFUNC1)(char* i_szStr, void* i_pContext);


/**
 * This is the data stream callback function. you will get the stream data here.
 * Add your own process logic here to process the output data stream.
 * @param const char* i_szStr  The buffer pointer of the output string
 * @param int   i_size   The size of the data(in byte)
 */
typedef void(*DATACALLBACKFUNC)(const char* i_szStr, int i_size);


/**
 * This is the one of two methods exposed from the DLL
 * Use this method to create a new instance of P2TProcessor
 * and return the pointer of the processor, The pointer must
 * be released use RleaseProcessor after converting.
 */
typedef P2TProcessor* (*CREATEPROCESSOR)();

/**
 * This is the one of the two methods exposed from the DLL
 * Use this method to release the processor instance created
 * by CreateProcessor
 *
 */
typedef void (*RELEASEPROCESSOR)(P2TProcessor* pProcessor);

/**
 * P2TProcessor is the class that encapsulates all the functions related
 * to PDF converting. You can get the instance of this class through 
 * CreateProcessor exposed from the DLL
 *
 */
class P2TProcessor {
public:

/**
 * This is the function that should be called first before you try to call
 * any other functions, It verifies the run time license information.
 * @param char* UserName  The register username.
 * @param char* Key       The register keycode.
 * @return int   zero:    Success. In trial version, always return zero.
 *           not zero:    Something wrong with username/key
 */
virtual int VerifyLicense(char* UserName, char* Key) = 0;
 

/**
 * This function pass in control information into P2TProcessor
 * before it does the converting job.
 * @param LOGCALLBACKFUNC pf   The log info callback function.
 * @param int i_nCntrlFlg      The control flag pass into the processor.
 * @param char* i_szPageRange  The output page range collection, pass in empty
 *                             string if you don't want to output page range. 
 * @param char* i_szPageBreaker   The breaker string of the page breaker.
 *                                passin empty string if don't need page breaker
 */
virtual void EngagePDFProcessor(LOGCALLBACKFUNC pf, int i_nCntrlFlg, char* i_szPageRange, char* i_szPageBreaker) = 0;
 


/**
 * This function parse pdf file and output the data into a file
 * @param char* i_pdfFile   The input pdf file's path and name.
 * @param char* i_txtFile   The output text file's path and name.
 * @return int    0   Success.
 *               -1   Something wrong during converting, check log callback func
 */
virtual int ParsePDF(char* i_pdfFile, char* i_txtFile) = 0;
 


/**
 * This function parse pdf file and output the data stream into the callback
 * function 
 * @param char* i_szPDFName:           The input pdf file's path and name.
 * @param DATACALLBACKFUNC i_pFunc:    The pointer of the callback function 
 * @param int i_nBufSize:              The max buffer size that will pass to the
 *                                     callback function.
 * @return int    0  Success.
 *               -1  Something wrong during converting, check log callback func 
 */
virtual int ParsePDF(const char* i_szPDFName, DATACALLBACKFUNC i_pFunc, int i_nBufSize) = 0;

/**
 * This function parse pdf file and output the data stream into the callback
 * function 
 * @param char* i_szPDFName:            The input pdf file's path and name.
 * @param DATACALLBACKFUNC1 i_pFunc:    The pointer of the callback function 
 * @param int i_nBufSize:               The max buffer size that will pass to the
 *                                      callback function.
 * @param void* i_pContext:             The context pointer that will pass to i_pFunc.
 * @return int    0  Success.
 *               -1  Something wrong during converting, check log callback func 
 */
virtual int ParsePDF(const char* i_szPDFName, DATACALLBACKFUNC1 i_pFunc, int i_nBufSize, void* i_pContext) = 0;

/**
 * Get current version information(build number of parsing engine).
 */
virtual const char* GetVersion() = 0;

};


#endif

Go back to top

 ? Copyright 2003 Powered by Retsina Software Solutions