DynaPDF Manual - Page 288

Previous Page 287   Index   Next Page 289

Function Reference
Page 288 of 818
bookmarks are connected with a SetOCGState action that simply toggles the layer states from on to
off or vice versa.
SI32 PDF_CALL PDFError(const void* Data, SI32 ErrCode,
const char* ErrMessage,
SI32 ErrType)
printf("%s\n", ErrMessage);
return 0; // We try to continue
int main(int argc, char* argv[])
SI32 oc1, oc2, bmkDE, bmkEN, act, retval = -2;
PPDF* pdf = pdfNewPDF();
if (!pdf) return -1; // Out of memory?
// Pass warnings and errors to this error callback function
pdfSetOnErrorProc(pdf, NULL, PDFError);
pdfCreateNewPDF(pdf, NULL);
oc1 = pdfCreateOCG(pdf, "Deutsch", true, false, oiAll);
oc2 = pdfCreateOCG(pdf, "English", true, true, oiAll);
bmkDE = pdfAddBookmark(pdf, "Deutsch", -1, 1, false);
bmkEN = pdfAddBookmark(pdf, "English", -1, 1, false);
UI32 toggle[2] = {oc1, oc2};
// Simply toggle the state from On to Off or vice versa
act = pdfCreateSetOCGStateAction(pdf,NULL,0,NULL,0,toggle,2,true);
// Add the action to the bookmarks
pdfAddActionToObj(pdf, otBookmark, oeOnMouseUp, act, bmkDE);
pdfAddActionToObj(pdf, otBookmark, oeOnMouseUp, act, bmkEN);
pdfSetPageCoords(pdf, pcTopDown);
pdfSetFont(pdf, "Arial", fsRegular | fsItalic, 12.0, true, cp1252);
// Text for the German layer
pdfBeginLayer(pdf, oc1);
- 100.0,

Previous topic: CreateSetOCGStateAction

Next topic: CreateSigField, How to lock an Interactive Form after signing?

Start Chat