You can assemble a PDF document that contains bookmarks.
For example, assume that you have a PDF document that does not contain bookmarks
and you want to modify it by providing bookmarks. Using the Assembler
service, you can pass it a PDF document that does not contain bookmarks
and get back a PDF document that contains bookmarks.
Bookmarks contain the following properties:
-
A title that appears as text on the screen.
-
An action that specifies what happens when a user clicks
on the bookmark. The typical action for a bookmark is to move to
another location in the current document or open another PDF document,
although other actions can be specified.
For the purpose of this discussion, assume that the following
DDX document is used.
<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<PDF result="FinalDoc.pdf">
<PDF source="Loan.pdf">
<Bookmarks source="doc2" />
</PDF>
</PDF>
</DDX>
Within this DDX document, notice that the source attribute is
assigned the value
Loan.pdf
. This DDX document
specifies that a single PDF document is passed to the Assembler
service. When assembling a PDF document with bookmarks, you must
specify a bookmark XML document that describes the bookmarks in
the result document. To specify a bookmark XML document, ensure
that the
Bookmarks
element is specified in your
DDX document.
In this example DDX document, the
Bookmarks
element
specifies
doc2
as the value. This value indicates that
the input map passed to the Assembler service contains a key named
doc2
.
The value of the
doc2
key is a
com.adobe.idp.Document
value
that represents the bookmark XML document. (See "Bookmarks Language"
in the
Assembler Service and DDX Reference
.)
This topic uses the following XML bookmarks language to assemble
a PDF document containing bookmarks.
<?xml version="1.0" encoding="UTF-8"?>
<Bookmarks xmlns="http://ns.adobe.com/pdf/bookmarks" version="1.0">
<Bookmark>
<Action>
<Launch NewWindow="true">
<File Name="C:\Adobe\LoanDetails.pdf" />
</Launch>
</Action>
<Title>Open the Loan document</Title>
</Bookmark>
<Bookmark>
<Action>
<Launch>
<Win Name="C:\WINDOWS\notepad.exe" />
</Launch>
</Action>
<Title>Launch NotePad</Title>
</Bookmark>
</Bookmarks>
Within this bookmark XML document, notice the Action element
that defines the action that is performed when a user clicks the
bookmark. Under the Action element is the Launch element that launches
applications, such as NotePad and opens files, such as PDF files.
To open a PDF file, you must use the File element that specifies
the file to open. For example, in the bookmark XML file specified
in this section, the name of the file that is opened is LoanDetails.pdf.
Given the DDX document specified in this section and bookmark
XML file as input, the Assembler service assembles a PDF document
that contains the following bookmarks.
When a user clicks on the
Open the Loan Details
bookmark,
the LoanDetails.pdf is opened. Likewise, when the user clicks on
the
Launch NotePad
bookmark, NotePad is started.
Before reading this section, it is recommended
that you be familiar with assembling PDF documents using the Assembler
service. This section does not discuss concepts, such as creating
a collection object that contains input documents or learning how
to extract the results from the returned collection object. (See
Programmatically Assembling PDF Documents
.)