Gnostice PDFOne
Pro. Ed. v5.0.0


com.gnostice.pdfone
Class PdfJavascriptAction

java.lang.Object
  extended bycom.gnostice.pdfone.PdfAction
      extended bycom.gnostice.pdfone.PdfJavascriptAction

public class PdfJavascriptAction
extends PdfAction

This class represents a JavaScript action.

PdfWriter writer1 = PdfWriter.fileWriter(
           new File("PdfJavascriptAction_example.pdf"));
PdfDocument doc1 = new PdfDocument(writer1);

// Create a PDF page
PdfPage page1 = new PdfPage();

// Render some text on the page
page1.writeText(
        "Click here to get a JavaScript-driven message ", 
        200, 100);

// Create a link annotation over a word rendered on page 1
PdfLinkAnnot la = 
    new PdfLinkAnnot(new PdfRect(223, 100, 23, 12), Color.BLUE);

// Create a JavaScript action for navigation into page 2
PdfJavascriptAction jsa = 
    new PdfJavascriptAction("app.alert(\"Hello, world!\")");

// Add the JavaScript action to the link annotation
la.addAction(jsa);

// Add the link annotation to page 1
page1.addAnnotation(la);

doc1.add(page1);
doc1.setOpenAfterSave(true);
doc1.write();
writer1.dispose();


Nested Class Summary
 
Nested classes inherited from class com.gnostice.pdfone.PdfAction
PdfAction.PdfEvent
 
Field Summary
 
Fields inherited from class com.gnostice.pdfone.PdfAction
GOTO, JAVASCRIPT, LAUNCH, NAMED, NAMED_FIND, NAMED_FIRSTPAGE, NAMED_LASTPAGE, NAMED_NEXTPAGE, NAMED_OPEN, NAMED_PREVPAGE, NAMED_PRINT, NAMED_SEARCH, REMOTE_GOTO, URI
 
Constructor Summary
PdfJavascriptAction(String javascript)
          Constructs a PDF JavaScript action with specified JavaScript script.
 
Method Summary
 String getJavascript()
          Returns JavaScript script specified for the PDF JavaScript action.
 void setJavascript(String javascript)
          Sets specified JavaScript script for the PDF JavaScript action.
 
Methods inherited from class com.gnostice.pdfone.PdfAction
getActionType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfJavascriptAction

public PdfJavascriptAction(String javascript)
Constructs a PDF JavaScript action with specified JavaScript script.

Parameters:
javascript - JavaScript script that needs to be executed by the action *
Method Detail

getJavascript

public String getJavascript()
Returns JavaScript script specified for the PDF JavaScript action.

Returns:
JavaScript script specified for the action

setJavascript

public void setJavascript(String javascript)
Sets specified JavaScript script for the PDF JavaScript action.

Parameters:
javascript - JavaScript script for the PDF JavaScript action

Gnostice PDFOne
Pro. Ed. v5.0.0

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2010 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com