getAllChildren().get(0).getAllChildren(); StringBuffer stringBuffer = new StringBuffer(); for (PdfOutline bookmark: bookmarks) { showTitle(bookmark, stringBuffer); }. Tags: iText 7building blocksChapter 6tutorialactionsdestinationsBookmarks drawn by the PDF viewer that renders annotations on top of the existing content. Interactivity within PDF documents is enabled though Anchors (links) and Bookmarks. Following earlier articles in my iTextSharp series, this.

Author: Vujinn Daigul
Country: Laos
Language: English (Spanish)
Genre: Video
Published (Last): 23 February 2013
Pages: 136
PDF File Size: 5.21 Mb
ePub File Size: 17.13 Mb
ISBN: 952-9-41050-261-1
Downloads: 92427
Price: Free* [*Free Regsitration Required]
Uploader: Durg

A destination on a page; see table 7.

The PdfExplicitDestination class can be used to create a destination to a specific page, using specific coordinates if needed.

Following earlier articles in my iTextSharp series, this particular contribution will introduce the basics of linking and bookmarking PDF documents created via iTextSharp.

The second parameter is the name we used when we added the paragraph “Table of Contents”. How to import bookmark from XML to existing pdf? Each HashMap item contains at least one of the keys listed in itextshrp 7.

In this case, we override the draw method. This option is itextshzrp identical to createFitHbut the with of the bounding box of the page is visible. The createNamed method accepts a PdfName as a parameter.

Add Page bookmark to an existing PDF using iTextSharp in C# – CodeProject

Take a look at figure 7. The extra parameter specifies the vertical coordinate of the top edge of the page. When we clicked a line in this table of contents, we jumped to the corresponding chapter. Print Share Twitter Facebook Email. When we click that outline, an URI action is triggered that brings us to the corresponding web page. Internally, iText will map that name with a specific position —aka an explicit destination— in the document.

If you exieting one of these dates, the corresponding page is opened. This number indicates the actual page, ezisting the label you may have given the page. This is equivalent to creating a PdfStringDestination using a String instance.


Both documents have bookmarks, and you want these bookmarks to be merged as shown in figure 7. The first paragraph contains the text “Click to go to Target”, and its reference is set to ” target”, just as with the HTML version. This isn’t the case in the example in which we create explicit destinations: This option is almost identical to createFitVbut the height of the bounding box of the page is visible.

Opens the file so that the rectangle specified with the parameters is visible. You can get this with the get-RootOutline method O.

Add Page bookmark to an existing PDF using iTextSharp in C#

We create a unique name for each chapter title in line Treat my content as plain text, not as HTML. By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of itextsharpp website existng subject to bookmmark policies. In the examples that follow, we’ll discover some boomkark types, and we’ll also learn about different types of destinations that can be used in a link. These links are added in lines, and respectively.

Creating actions, destinations, and bookmarks Tags: You first obtain a List of HashMap objects. Add chapter2 ; or refer to below link.

The following URL opens the documentation about open actions on page 5 using a magnifying factor that ensures that the complete page fits within the viewer window:.

Last post May 20, We’ll take a closer look at these classes later on in this chapter. We get the value of each entry line 42 to construct the content of each line in the table of contents: The submit action could be the last action in a validation chain.


When we open the bookmark panel, we bokkmark an outline tree of which all first-level elements are titles of a movie, cartoon or video. They can point to nowhere; they can also be used to trigger an action.

Chapter 6: Creating actions, destinations, and bookmarks

Adding bookmarks is not an allowed operation, so you’ll have to remove all signature fields before applying the change. Add new Chunk “Click ” ; p4.

If you have a question, for instance, if you have tried what is explained in this post, and if it boommark work, explain what you have tried in a new question and explain the problem you are experiencing. We use the PdfLinkAnnotation to create a Link object in line 5.

Add click ; doc. The PdfOutline class offers much more functionality, and you can use it to create bookmarks for existing documents.

The other difference is that itexrsharp now used named destinations. We change the color of this title to blue line 11 and bold line After we learned that links are stored inside a PDF as annotationswe looked at some bookmark examples.

A scale value of gives percent zoom; left and top are set in a coordinate system where the origin is the top left itextsnarp the visible page, regardless of the document rotation. We also explained that links are actually annotations.

Add new Chunk ” to find local goto” ; p4. We won’t go into detail regarding the JavaScript functionality in PDF, but we’ll create a simple PDF that shows an alert when you click a link; see figure 6.