public class PdfURIAction extends PdfAction
PdfWriter writer1 = PdfWriter.fileWriter(
new File("PdfURIAction_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 visit Gnostice website.",
200, 100);
// Create a link annotation over a word rendered on page 1
PdfLinkAnnot lAnnot =
new PdfLinkAnnot(new PdfRect(223, 100, 23, 12), Color.BLUE);
// Create a remote go-to action for navigation into page 3
// of another document in the same directory
PdfURIAction ua =
new PdfURIAction("www.gnostice.com");
// Add the remote go-to action to the link annotation
lAnnot.addAction(ua);
// Add the link annotation to page 1
page1.addAnnotation(lAnnot);
doc1.add(page1);
doc1.setOpenAfterSave(true);
doc1.write();
writer1.dispose();
PdfAction.PdfEventGOTO, JAVASCRIPT, LAUNCH, NAMED, NAMED_FIND, NAMED_FIRSTPAGE, NAMED_LASTPAGE, NAMED_NEXTPAGE, NAMED_OPEN, NAMED_PREVPAGE, NAMED_PRINT, NAMED_SEARCH, REMOTE_GOTO, URI| Constructor and Description |
|---|
PdfURIAction(String uri)
Constructs a PDF URI action with specified URI.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getUri()
Returns URI that the action will make the viewer application to
resolve.
|
void |
prepareActionDict() |
void |
setUri(String uri)
Sets the action to make the viewer application to resolve
specified URI.
|
getActionTypepublic PdfURIAction(String uri)
uri - Uniform Resource Identifier (URI) that the action
should make the viewer application to resolvepublic String getUri()
public void setUri(String uri)
uri - URI that the action will make the viewer application
to resolvepublic void prepareActionDict()
throws PdfException
PdfException