Class PdfAction


public class PdfAction extends PdfDictionary
A PdfAction defines an action that can be triggered from a PDF file.
See Also:
  • Field Details

    • FIRSTPAGE

      private static final int FIRSTPAGE
      A named action to go to the first page.
      See Also:
    • PREVPAGE

      private static final int PREVPAGE
      A named action to go to the previous page.
      See Also:
    • NEXTPAGE

      private static final int NEXTPAGE
      A named action to go to the next page.
      See Also:
    • LASTPAGE

      private static final int LASTPAGE
      A named action to go to the last page.
      See Also:
    • PRINTDIALOG

      private static final int PRINTDIALOG
      A named action to open a print dialog.
      See Also:
  • Constructor Details

    • PdfAction

      public PdfAction()
      Create an empty action.
    • PdfAction

      public PdfAction(URL url)
      Constructs a new PdfAction of Subtype URI.
      Parameters:
      url - the Url to go to
    • PdfAction

      public PdfAction(String url)
      Constructs a new PdfAction of Subtype URI.
      Parameters:
      url - the url to go to
    • PdfAction

      private PdfAction(String url, boolean isMap)
      Construct a new PdfAction of Subtype URI that accepts the x and y coordinate of the position that was clicked.
      Parameters:
      url -
      isMap -
    • PdfAction

      PdfAction(PdfIndirectReference destination)
      Constructs a new PdfAction of Subtype GoTo.
      Parameters:
      destination - the destination to go to
    • PdfAction

      public PdfAction(String filename, String name)
      Constructs a new PdfAction of Subtype GoToR.
      Parameters:
      filename - the file name to go to
      name - the named destination to go to
    • PdfAction

      public PdfAction(String filename, int page)
      Constructs a new PdfAction of Subtype GoToR.
      Parameters:
      filename - the file name to go to
      page - the page destination to go to
    • PdfAction

      public PdfAction(int named)
      Implements name actions. The action can be FIRSTPAGE, LASTPAGE, NEXTPAGE, PREVPAGE and PRINTDIALOG.
      Parameters:
      named - the named action
    • PdfAction

      public PdfAction(String application, String parameters, String operation, String defaultDir)
      Launches an application or a document.
      Parameters:
      application - the application to be launched or the document to be opened or printed.
      parameters - (Windows-specific) A parameter string to be passed to the application. It can be null.
      operation - (Windows-specific) the operation to perform: "open" - Open a document, "print" - Print a document. It can be null.
      defaultDir - (Windows-specific) the default directory in standard DOS syntax. It can be null.
  • Method Details

    • rendition

      static PdfAction rendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) throws IOException
      Creates a Rendition action
      Parameters:
      file -
      fs -
      mimeType -
      ref -
      Returns:
      a Media Clip action
      Throws:
      IOException
    • javaScript

      static PdfAction javaScript(String code, PdfWriter writer, boolean unicode)
      Creates a JavaScript action. If the JavaScript is smaller than 50 characters it will be placed as a string, otherwise it will be placed as a compressed stream.
      Parameters:
      code - the JavaScript code
      writer - the writer for this action
      unicode - select JavaScript unicode. Note that the internal Acrobat JavaScript engine does not support unicode, so this may or may not work for you
      Returns:
      the JavaScript action
    • createHide

      private static PdfAction createHide(PdfObject obj, boolean hide)
      A Hide action hides or shows an object.
      Parameters:
      obj - object to hide or show
      hide - true is hide, false is show
      Returns:
      a Hide Action
    • buildArray

      private static PdfArray buildArray(Object[] names)
    • gotoEmbedded

      private static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow)
      Creates a GoToE action to an embedded file.
      Parameters:
      filename - the root document of the target (null if the target is in the same document)
      target - a path to the target document of this action
      dest - the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString
      newWindow - if true, the destination document should be opened in a new window
      Returns:
      a GoToE action