DynaPDF Manual - Page 772

Previous Page 771   Index   Next Page 773

Function Reference
Page 772 of 839
SetOCGState
Syntax:
LBOOL pdfSetOCGState(
const PPDF* IPDF, // Instance pointer
UI32 Handle,
// OCG handle
LBOOL On,
// Wished state: true = visible, false = invisible
LBOOL SaveState)
// Save the state in the PDF file?
The function changes the visibility state of an OCG or layer. If the parameter SaveState is true, the
new state is also saved in the PDF file. Otherwise, the state is only changed temporarily so that the
wished state can be rendered with RenderPage() or RenderPageToImage() for example.
Note that only the new state of the current OCG will be be saved. If the state of other OCGs were
changed beforehand, while SaveState was set to false, then these changes will not be considered.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
SetOnErrorProc
Syntax:
LBOOL pdfSetOnErrorProc(
const PPDF* IPDF,
// Instance pointer
const void* Data,
// User defined pointer or NULL
const void* ErrProc)
// Callback function, see below
typedef SI32 PDF_CALL TErrorProc(
const void* Data,
// User defined pointer
SI32 ErrCode,
// Error code starting at zero
const char* ErrMessage, // Null-terminated error string
SI32 ErrType);
// Error types, see below
#define PDF_CALL __stdcall // Windows only, otherwise empty
The function sets an error callback function which is called by DynaPDF to output error messages
and warnings. The parameter Data holds a user defined pointer which is passed unchanged to the
callback function. If this pointer is not required set it to NULL.
The calling convention of the callback function is standard call under Windows. Note that a wrongly
defined calling convention causes an access violation.
The Visual Basic 6 interface uses events instead of a callback function, see Language Binding Visual
Basic). In VB .Net you can use events or a an error callback function.
ErrCode is a positive error number starting at zero; it is an index into the array of error messages.
The error messages are defined in the file main/drv_base_err_msg.h (this file is included in
DynaPDF Enterprise only). ErrType is a bitmask to determine what kind of error occurred. The
following constants are defined:
#define E_WARNING
0x02000000
#define E_SYNTAX_ERROR 0x04000000
 

Previous topic: SetOCGContUsage

Next topic: SetOnPageBreakProc