|
Tutorial - Document and Page Events |
Top Previous Next |
|
This tutorial creates an application to activate Document and Page Events using actions. The classes provided are gtPDFPageLevelAction and gtPDFDocumentLevelAction.
[VB]
'Load the Document PDFDoc.LoadFromFile (InputFile1) Dim GOT As gtPDFGoToActionX Set GOT = PDFDoc.CreatePDFGoToAction() GOT.DestinationType = TxgtPDFDestinationType.dtFitBV GOT.PageNo = 4 PDFDoc.AddPageLevelGoToAction GOT, TxgtPageActionTriggers.aatBeforePageOpen, 3 Dim JAV, JAV2 As gtPDFJavaScriptActionX() JAV.JavaScript = "app.alert('Before Page Opens ')" Set JAV2 = PDFDoc.CreatePDFJavaScriptAction() JAV2.JavaScript = "app.alert('After Page Close')" PDFDoc.AddPageLevelJavaScriptAction JAV2, TxgtPageActionTriggers.aatAfterPageClose, 2 PDFDoc.AddPageLevelJavaScriptAction JAV, TxgtPageActionTriggers.aatBeforePageOpen, 2 'Save the Document PDFDoc.SaveToFile (OutputFile)
[VC++]
// Load the Document PDFDoc.LoadFromFile(InputFile1); CgtPDFJavaScriptActionX JAV, JAV2; JAV = PDFDoc.CreatePDFJavaScriptAction(); JAV.SetJavaScript ("app.alert(\"Before Page Opens \")"); JAV2 = PDFDoc.CreatePDFJavaScriptAction(); JAV2.SetJavaScript ("app.alert(\"After Page Close\")"); PDFDoc.AddPageLevelJavaScriptAction(JAV2, 1/*aatAfterPageClose*/,2); PDFDoc.AddPageLevelJavaScriptAction( JAV, 0/*aatBeforePageOpen*/,2); // Save the Document PDFDoc.SaveToFile(OutputFile);
[CS]
// Load the Document PDFDoc.LoadFromFile(InputFile1); gtPDFGoToActionX GOT ; GOT = (gtPDFGoToActionX)PDFDoc.CreatePDFGoToAction(); GOT.DestinationType = TxgtPDFDestinationType.dtFitBV; GOT.PageNo = 4; PDFDoc.AddPageLevelGoToAction(GOT, TxgtPageActionTriggers.aatBeforePageOpen, 3); gtPDFJavaScriptActionX JAV, JAV2; JAV = PDFDoc.CreatePDFJavaScriptAction(); JAV.JavaScript = "app.alert(\"Before Page Opens \")"; JAV2 = PDFDoc.CreatePDFJavaScriptAction(); JAV2.JavaScript = "app.alert(\"After Page Close\")"; PDFDoc.AddPageLevelJavaScriptAction(JAV2,TxgtPageActionTriggers.aatAfterPageClose,2); PDFDoc.AddPageLevelJavaScriptAction(JAV,TxgtPageActionTriggers.aatBeforePageOpen,2); //Save the Document PDFDoc.SaveToFile(OutputFile);
|