You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/10/10 23:35:34 UTC
[jira] [Closed] (PDFBOX-339) Trying to assign an action to a
bookmark
[ https://issues.apache.org/jira/browse/PDFBOX-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Hewson closed PDFBOX-339.
------------------------------
Resolution: Invalid
Closed because this is a "how to" question.
> Trying to assign an action to a bookmark
> ----------------------------------------
>
> Key: PDFBOX-339
> URL: https://issues.apache.org/jira/browse/PDFBOX-339
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Priority: Minor
>
> [imported from SourceForge]
> http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1893204
> Originally submitted by nobody on 2008-02-13 16:00.
> I need to be able to assign an action to a bookmark, to open an external file.
> I am having a difficult time trying to figure this out, so any assistance would be greatly appreciated.
> Here is the section of code trying to accomplish this:
> Case "Master Agenda"
> 'Get the list of pages in the document
> Dim pages As ArrayList = PdfDoc.getDocumentCatalog.getAllPages()
> Dim i, pageNumber As Integer
> pageNumber = 0
> Dim row As DataRow = Nothing
> Dim ParentChild As String = String.Empty
> Dim bookmarkTitle As String = String.Empty
> Dim pdfFileName As String = String.Empty
> 'loop thru the bookmark datatable and add bookmarks to the document accordingly
> For i = 0 To rowCount - 1 Step 1
> ' Dim rowArrayData() As String
> 'Read the row's data
> row = bookmarkTable.Rows(i)
> bookmarkTitle = row.Item("bookmarkTitle")
> 'Get the page at pageNumber from pages list
> Dim page As PDPage = CType(pages.get(pageNumber), PDPage)
> Dim dest As PDPageFitWidthDestination = New PDPageFitWidthDestination()
> Dim externalFile As New interactive.action.type.PDWindowsLaunchParams()
> externalFile.setFilename("C:\DBPRTestData\FINAL ACTION\Processed\FINAL ACTION-APRIL_2008 - Case # 0000000000100000000.PDF")
> externalFile.setOperation("open")
> ' externalFile.setF("C:\DBPRTestData\FINAL ACTION\Processed\FINAL ACTION-APRIL_2008 - Case # 0000000000100000000.PDF")
> 'externalFile.setExecuteParam( shouldOpenInNewWindow()
> 'externalFile.setType("open")
> dest.setPage(page)
> 'Determine the bookmark type (parent or child)
> ' In this case:
> ' Parent bookmark type is an Agenda Item
> ' Child bookmark type are Supporting Documents
> bookmark = New PDOutlineItem
> bookmark.setDestination(dest)
> bookmark.setTitle(bookmarkTitle.Trim)
> Dim openAction As New interactive.action.type.PDActionLaunch
> openAction.setType("open")
> 'Dim openActionStr As String =
> bookmark.setAction(openAction)
> 'Add this child bookmark to the parent's bookmark
> pagesOutline.appendChild(bookmark)
> Next i
> End Select
> 'Expand the bookmark tree
> pagesOutline.openNode()
> outline.openNode()
> 'Save the the document to a file
> PdfDoc.save(outFile)
> result = True
> [comment on SourceForge]
> Originally sent by maleman2045.
> Logged In: YES
> user_id=2008850
> Originator: NO
> Sorry, I posted this entry before I created my account.
> I'll be monitoring this for a response.
> Thanks!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)