RecAPI
RecPDF Module

This is the "C" level API of RecPDFAPI. RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X. More...

Typedefs

typedef struct tagRPDF_DOC * RPDF_DOC
 Handle of a PDF document.
typedef struct tagRPDF_OPERATION * RPDF_OPERATION
 Handle of a PDF operation.
typedef struct
tagRPDF_FILEENUMERATOR * 
RPDF_FILEENUMERATOR
 Handle of an enumerator for the PDF documents taking part in a PDF operation.

Enumerations

enum  RPDF_ENCRYPTION {
  ENC_NO,
  ENC_RC4,
  ENC_AES
}
 Encryption type of a PDF file. More...
enum  RPDF_RESTRICTIONS {
  PSR_NO_PRINT = 0x00000100,
  PSR_NO_HIPRINT = 0x00000200,
  PSR_NO_COPY = 0x00000400,
  PSR_NO_EXTRACT_TEXT = 0x00000800,
  PSR_NO_EXTRACT_PAGES = 0x00001000,
  PSR_NO_CHANGE = 0x00002000,
  PSR_NO_ASSEMBLE = 0x00004000,
  PSR_NO_ACROFORM = 0x00008000,
  PSR_NO_ANNOT = 0x00010000
}
 PDF security restriction flags. More...
enum  RPDF_ROTATION {
  PDFROT_NO = 0,
  PDFROT_LEFT,
  PDFROT_RIGHT,
  PDFROT_HALFTURN
}
 Page rotation. More...
enum  PDF_Version
 PDF version.
enum  PDFA_Version
 PDFA version.

Functions

RECERR PDFASMAPI rPdfInit (void)
 Initialize the RecPDF.
RECERR PDFASMAPI rPdfQuit (void)
 Uninitialize the RecPDF.
RECERR PDFASMAPI rPdfOpen (LPCTSTR pFileName, LPCTSTR password, RPDF_DOC *handle)
 Open a PDF file.
RECERR PDFASMAPI rPdfCompact (LPCTSTR pInFileName, LPCTSTR pOutFileName)
 Compact a PDF document.
RECERR PDFASMAPI rPdfClose (RPDF_DOC handle)
 Close a PDF document.
RECERR PDFASMAPI rPdfGetOp (RPDF_DOC handle, RPDF_OPERATION *ophandle)
 Get the PDF operation assigned to a PDF document.
RECERR PDFASMAPI rPdfGetPath (RPDF_DOC handle, LPTSTR buffer, size_t buflen)
 Get the path of the PDF document.
RECERR PDFASMAPI rPdfFileHasText (RPDF_DOC handle, size_t position, bool *bHasText)
 Check if a page of the PDF document does have or doesn't have searchable text.
RECERR PDFASMAPI rPdfGetPageCount (RPDF_DOC handle, size_t *pnPages)
 Get the page count of a PDF document.
RECERR PDFASMAPI rPdfOpStart (RPDF_OPERATION *Ophandle)
 Start a new PDF operation.
RECERR PDFASMAPI rPdfOpAddFile (RPDF_OPERATION ophandle, RPDF_DOC handle)
 Add a PDF document to the PDF operation.
RECERR PDFASMAPI rPdfOpGetFirstFile (RPDF_OPERATION ophandle, RPDF_DOC *handle, size_t *numfiles, RPDF_FILEENUMERATOR *enumerator)
 Get the first assigned PDF document of a PDF operation.
RECERR PDFASMAPI rPdfOpGetNextFile (RPDF_FILEENUMERATOR enumerator, RPDF_DOC *handle)
 Get the next assigned PDF document of a PDF operation.
RECERR PDFASMAPI rPdfOpCloseFileEnumeration (RPDF_FILEENUMERATOR enumerator)
 Close the enumeration of the assigned PDF documents in the PDF operation.
RECERR PDFASMAPI rPdfOpRotatePage (RPDF_OPERATION ophandle, RPDF_DOC handle, size_t position, RPDF_ROTATION rotation)
 Rotate a page in a PDF document as a part of a PDF operation.
RECERR PDFASMAPI rPdfOpDeletePages (RPDF_OPERATION ophandle, RPDF_DOC handle, const size_t *PageIndexArr, size_t numpages)
 Delete one or more pages in a PDF document as a part of a PDF operation.
RECERR PDFASMAPI rPdfOpCopyPages (RPDF_OPERATION ophandle, RPDF_DOC desthandle, size_t destposition, RPDF_DOC srchandle, const size_t *PageIndexArr, size_t numpages)
 Copy pages as a part of a PDF operation.
RECERR PDFASMAPI rPdfOpMovePages (RPDF_OPERATION ophandle, RPDF_DOC handle, size_t destposition, const size_t *PageIndexArr, size_t numpages)
 Move pages as a part of a PDF operation.
RECERR PDFASMAPI rPdfOpCancel (RPDF_OPERATION ophandle)
 Cancel a PDF operation.
RECERR PDFASMAPI rPdfOpExecute (RPDF_OPERATION ophandle)
 Execute a PDF operation.
RECERR PDFASMAPI rPdfOpInsertHPAGEs (RPDF_OPERATION ophandle, RPDF_DOC desthandle, size_t destposition, const HPAGE *srcpages, size_t srcpagecount, bool bImageOnly)
 Insert pages to the PDF given by HPAGE handles.
RECERR PDFASMAPI rPdfOpMergeTextToPages (RPDF_OPERATION ophandle, RPDF_DOC desthandle, size_t destposition, const HPAGE *srcpages, size_t srcpagecount)
 Insert the text content of the given HPAGE handles to the specified PDF pages.
RECERR PDFASMAPI rPdfGetPDFSecurityInfo (LPCTSTR pFileName, RPDF_ENCRYPTION *encMethod, size_t *keySize, RPDF_RESTRICTIONS *secuRestrictions, bool *hasMasterPassword, bool *hasUserPassword)
 Get PDF encryption information without opening it.
RECERR PDFASMCALL rPdfOptOpen (LPCTSTR pFileName, LPCTSTR password, RPDF_DOC *handle)
 Open a PDF file.
RECERR PDFASMCALL rPdfOptAddCommandStr (RPDF_DOC handle, LPCTSTR command)
 Add an optimization command string to a handle.
RECERR PDFASMCALL rPdfOptimize (RPDF_DOC handle, LPCTSTR pOptFileName)
 Do the optimization process.

Detailed Description

This is the "C" level API of RecPDFAPI. RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.

This is the "C" level Page Oriented PDF File Manipulation API of OmniPage CSDK.

This part of RecAPI is an extension can be used both with KernelAPI and with RecAPIPlus. One of them should be initialized before initialization of RecPDF.

List of header files of this module:

The library file that should be linked is recpdf.lib, but there is an alternative solution: the dynamic linking using RecPDFS.


Enumeration Type Documentation

Encryption type of a PDF file.

Enumerator:
ENC_NO 

Not encrypted.

ENC_RC4 

RC4 algorithm.

ENC_AES 

AES algorithm.

PDF security restriction flags.

Enumerator:
PSR_NO_PRINT 

Printing isn't allowed.

PSR_NO_HIPRINT 

Print the document only low resolution mode.

PSR_NO_COPY 

Can not copy the content to other document.

PSR_NO_EXTRACT_TEXT 

Extracting the content is prohibited. (For accessibility usings for disabled users.)

PSR_NO_EXTRACT_PAGES 

Extracting the pages is prohibited.

PSR_NO_CHANGE 

Modifying the content is prohibited.

PSR_NO_ASSEMBLE 

Document assemble is prohibited (can not insert, rotate, delete pages, and create bookmarks or thumbnails).

PSR_NO_ACROFORM 

Filling in form fields are prohibited.

PSR_NO_ANNOT 

Adding or modifying annotations are prohibited.

Page rotation.

Enumerator:
PDFROT_NO 

No rotation.

PDFROT_LEFT 

Rotate counter clockwise.

PDFROT_RIGHT 

Rotate clockwise.

PDFROT_HALFTURN 

Rotate 180 degrees.


Function Documentation

RECERR PDFASMAPI rPdfClose ( RPDF_DOC  handle)

Close a PDF document.

Destroys the PDF document object.

Return values:
RECERR
Parameters:
[in]handleHandle of the PDF document.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
All unsaved data will be lost.
The handle won't be valid any more.
RECERR PDFASMAPI rPdfCompact ( LPCTSTR  pInFileName,
LPCTSTR  pOutFileName 
)

Compact a PDF document.

Save the compacted PDF document into a new file.

Return values:
RECERR
Parameters:
[in]pInFileNameFull path of the input file.
[in]pOutFileNameFull path of the output file.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfFileHasText ( RPDF_DOC  handle,
size_t  position,
bool *  bHasText 
)

Check if a page of the PDF document does have or doesn't have searchable text.

Return values:
RECERR
Parameters:
[in]handleHandle of the PDF document.
[in]positionPage index in the PDF document.
[out]bHasTextExistence of searchable text in the page of the PDF document.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfGetOp ( RPDF_DOC  handle,
RPDF_OPERATION ophandle 
)

Get the PDF operation assigned to a PDF document.

At a time only one PDF operation can be assigned to a PDF document. If there is such an PDF operation, this function will give it back. If there is no such PDF operation NULL will be returned.

Return values:
RECERR
Parameters:
[in]handleHandle of the PDF document.
[out]ophandleThe return value is the handle of the PDF operation if an PDF operation is assigned to the PDF document, otherwise NULL.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfGetPageCount ( RPDF_DOC  handle,
size_t *  pnPages 
)

Get the page count of a PDF document.

Return values:
RECERR
Parameters:
[in]handleHandle of the PDF document.
[out]pnPagesCount of pages in the PDF document.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfGetPath ( RPDF_DOC  handle,
LPTSTR  buffer,
size_t  buflen 
)

Get the path of the PDF document.

Read the path string from the PDF file.

Return values:
RECERR
Parameters:
[in]handleHandle of the PDF document.
[out]bufferString buffer to store the full path of the PDF document.
[out]buflenLength of the buffer.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfGetPDFSecurityInfo ( LPCTSTR  pFileName,
RPDF_ENCRYPTION encMethod,
size_t *  keySize,
RPDF_RESTRICTIONS secuRestrictions,
bool *  hasMasterPassword,
bool *  hasUserPassword 
)

Get PDF encryption information without opening it.

Return values:
RECERR
Parameters:
[in]pFileNameFull path of the source file.
[out]encMethodEncryption method of the PDF file. (Can be NULL if not needed.)
[out]keySizeEncryption's key size. (Can be NULL if not needed.)
[out]secuRestrictionsRestrictions on the PDF file. (Can be NULL if not needed.)
[out]hasMasterPasswordWhether the PDF file has master password. (Can be NULL if not needed.)
[out]hasUserPasswordWhether the PDF file has user password. (Can be NULL if not needed.)
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfInit ( void  )

Initialize the RecPDF.

The rPdfInit starts the PDF assembler SDK. All RecPDF functions must be called between an rPdfInit and an rPdfQuit calls.

Return values:
RECERR
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
Before rPdfInit a kRecInit or RecInitPlus must be called to initialize the CSDK.
RECERR PDFASMAPI rPdfOpAddFile ( RPDF_OPERATION  ophandle,
RPDF_DOC  handle 
)

Add a PDF document to the PDF operation.

A PDF operation is able to use only those PDF document whose are assigned to it.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[in]handleHandle of the PDF document.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
Once a PDF document is assigned to a PDF operation, there is no way to unassign it.
RECERR PDFASMAPI rPdfOpCancel ( RPDF_OPERATION  ophandle)

Cancel a PDF operation.

Destroys a PDF operation without executing it. This PDF operation handle cannot be used anymore. All page objects will be freed up and cannot be used anymore. All PDF documents will show the same state as before the PDF operation has started.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfOpCloseFileEnumeration ( RPDF_FILEENUMERATOR  enumerator)

Close the enumeration of the assigned PDF documents in the PDF operation.

Destroys the enumerator of the assigned PDF documents.

Return values:
RECERR
Parameters:
[in]enumeratorHandle of the PDF document enumerator.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfOpCopyPages ( RPDF_OPERATION  ophandle,
RPDF_DOC  desthandle,
size_t  destposition,
RPDF_DOC  srchandle,
const size_t *  PageIndexArr,
size_t  numpages 
)

Copy pages as a part of a PDF operation.

Add a copy page command to a PDF operation. It can copy pages from a PDF document to another PDF document or inside a single PDF document.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[in]desthandleHandle of the destination PDF document.
[in]destpositionStarting page index in the destination PDF document. The first copied page will get this page index. All other copied pages will be copied continually after the first one. If this equals to the count of pages of the destination PDF document or (size_t)-1, then the new pages will be appended to the PDF document.
[in]srchandleHandle of the source PDF document. It can be the same as the desthandle. If it is NULL, then the source document will be the same as the destination.
[in]PageIndexArrArray of page indices in the source PDF document.
[in]numpagesCount of pages to copy. This is the number of elements in the PageIndexArr array.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
The command takes place when the PDF operation is executed.
After the call all functions will see as if the copy has been already taken place.
RECERR PDFASMAPI rPdfOpDeletePages ( RPDF_OPERATION  ophandle,
RPDF_DOC  handle,
const size_t *  PageIndexArr,
size_t  numpages 
)

Delete one or more pages in a PDF document as a part of a PDF operation.

Add a page delete command to a PDF operation.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[in]handleHandle of the PDF document.
[in]PageIndexArrArray of the page indices in the PDF document.
[in]numpagesCount of pages to delete. This is the number of elements in the PageIndexArr.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
The command takes place when the PDF operation is executed.
After the call all functions will see as if the deletion has been already taken place.
RECERR PDFASMAPI rPdfOpen ( LPCTSTR  pFileName,
LPCTSTR  password,
RPDF_DOC handle 
)

Open a PDF file.

Create a PDF document object, and assign an existing PDF file to it. Then gives back a handle for the PDF document.

Return values:
RECERR
Parameters:
[in]pFileNameFull path of the source file.
[in]passwordPointer to the PDF password or NULL or empty string if no password is needed.
[out]handlePDF document handle.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfOpExecute ( RPDF_OPERATION  ophandle)

Execute a PDF operation.

Execute a PDF operation and after the execution destroy it. This PDF operation handle cannot be used anymore. All page objects will be freed up and cannot be used anymore.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
There is no guarantee that all commands will be executed.
RECERR PDFASMAPI rPdfOpGetFirstFile ( RPDF_OPERATION  ophandle,
RPDF_DOC handle,
size_t *  numfiles,
RPDF_FILEENUMERATOR enumerator 
)

Get the first assigned PDF document of a PDF operation.

Start the enumeration of the assigned PDF document of a PDF operation. The created file enumerator must be freed up after use with the rPdfOpCloseFileEnumeration function call.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[out]handleHandle of the first PDF document.
[out]numfilesCount of assigned PDF documents in the PDF operation.
[out]enumeratorNew enumerator handle. This handle can be used to continue the enumeration with the rPdfOpGetNextFile.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
By the time when the enumeration takes place the PDF operation object or the referenced PDF documents may be destroyed. If the PDF operation object is destroyed a referenced PDF document may be attached to another PDF operation.
RECERR PDFASMAPI rPdfOpGetNextFile ( RPDF_FILEENUMERATOR  enumerator,
RPDF_DOC handle 
)

Get the next assigned PDF document of a PDF operation.

Step the enumerator of the assigned PDF document and give back the next one.

Return values:
RECERR
Parameters:
[in]enumeratorHandle of the PDF document enumerator.
[out]handleAssigned PDF document in the PDF operation.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfOpInsertHPAGEs ( RPDF_OPERATION  ophandle,
RPDF_DOC  desthandle,
size_t  destposition,
const HPAGE srcpages,
size_t  srcpagecount,
bool  bImageOnly 
)

Insert pages to the PDF given by HPAGE handles.

Add an insert HPAGE command to a PDF operation. It can insert pages to a PDF document by HPAGE.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[in]desthandleHandle of the destination PDF document.
[in]destpositionStarting page index in the destination PDF document. The first inserted page will get this page index. All other inserted pages will be inserted continually after the first one. If this equals to the count of pages of the destination PDF document or (size_t)-1, then the new pages will be appended to the PDF document.
[in]srcpagesArray of pages given by HPAGEs.
[in]srcpagecountCount of HPAGEs to insert. This is the number of elements in the srcpages array.
[in]bImageOnlyIf this parameter is true, the command inserts only the images without the recognized text.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
The command takes place when the PDF operation is executed.
The HPAGEs can free after the end of the operation.
After the call all functions will see as if the insertion has been already taken place.
RECERR PDFASMAPI rPdfOpMergeTextToPages ( RPDF_OPERATION  ophandle,
RPDF_DOC  desthandle,
size_t  destposition,
const HPAGE srcpages,
size_t  srcpagecount 
)

Insert the text content of the given HPAGE handles to the specified PDF pages.

Add a Make Pages Searchable command to a PDF operation. It can merge the text content of a HPAGE to the specified pages.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[in]desthandleHandle of the destination PDF document.
[in]destpositionStarting page index in the destination PDF document. The first searchable page will get this page index. All other searchable pages will continually after the first one.
[in]srcpagesArray of pages given by HPAGEs.
[in]srcpagecountCount of HPAGEs to insert. This is the number of elements in the srcpages array.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
The command takes place when the PDF operation is executed.
After this function call, the HPAGE can free by the caller.
After the call all functions will see as if the insertion has been already taken place.
RECERR PDFASMAPI rPdfOpMovePages ( RPDF_OPERATION  ophandle,
RPDF_DOC  handle,
size_t  destposition,
const size_t *  PageIndexArr,
size_t  numpages 
)

Move pages as a part of a PDF operation.

Add a move page command to a PDF operation. It can move pages inside a single PDF document.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[in]handleHandle of the PDF document.
[in]destpositionThe starting page index. This will be the page index of the first moved page. All other move pages will be moved continually after the first one. If this equals to the count of pages of the destination PDF document or (size_t)-1, then the new pages will be appended to the PDF document.
[in]PageIndexArrArray of page indices in the source PDF document.
[in]numpagesCount of pages to copy. This is the number of elements in the PageIndexArr array.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
The command takes place when the PDF operation is executed.
After the call all functions will see as if the move has been already taken place.
RECERR PDFASMAPI rPdfOpRotatePage ( RPDF_OPERATION  ophandle,
RPDF_DOC  handle,
size_t  position,
RPDF_ROTATION  rotation 
)

Rotate a page in a PDF document as a part of a PDF operation.

Add a page rotate command to a PDF operation.

Return values:
RECERR
Parameters:
[in]ophandleHandle of the PDF operation.
[in]handleHandle of the PDF document.
[in]positionPage index in the PDF document.
[in]rotationHow much rotate the page.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
The command takes place when the PDF operation is executed.
After the call all functions will see as if the rotation has been already taken place.
If the page is a part of a page object, then it will be removed from the page object.
RECERR PDFASMAPI rPdfOpStart ( RPDF_OPERATION Ophandle)

Start a new PDF operation.

Create a new PDF operation object.

Return values:
RECERR
Parameters:
[out]OphandleHandle of the new PDF operation.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMCALL rPdfOptAddCommandStr ( RPDF_DOC  handle,
LPCTSTR  command 
)

Add an optimization command string to a handle.

See the possible command strings in the RecPDF help! You can specify more command strings by calling this function more than once

Return values:
RECERR
Parameters:
[in]handleHandle of the PDF operation.
[in]commandCommands, see the command descriptions.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMCALL rPdfOptimize ( RPDF_DOC  handle,
LPCTSTR  pOptFileName 
)

Do the optimization process.

Return values:
RECERR
Parameters:
[in]handleHandle of the PDF operation.
[in]pOptFileNameFull path of the optimized output file.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMCALL rPdfOptOpen ( LPCTSTR  pFileName,
LPCTSTR  password,
RPDF_DOC handle 
)

Open a PDF file.

Create a PDF document object, and assign an existing PDF file to it. Then gives back a handle for the PDF document. This handle can be used only for PDF optimalization. Do not add to an Operation

Return values:
RECERR
Parameters:
[in]pFileNameFull path of the source file.
[in]passwordPointer to the PDF password or NULL or empty string if no password is needed.
[out]handlePDF document handle.
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
RECERR PDFASMAPI rPdfQuit ( void  )

Uninitialize the RecPDF.

The rPdfQuit stops the PDF assembler SDK. All RecPDF functions must be called between an rPdfInit and an rPdfQuit calls.

Return values:
RECERR
Note:
RecPDF API-level of CSDK is supported on: Windows, Linux, Mac OS X.
After rPdfQuit a kRecQuit or RecQuitPlus must be called to shut down the CSDK.