pdf links

PDF Rendering
Convert PDF to Image (.NET)
Convert PDF to image on Android (Xamarin)
Convert PDF to image on iOS (Xamarin)
Convert PDF to image in Windows Store apps (.NET)
Convert PDF to image in Windows Phone apps (.NET)
PDF to image in Universal Windows Store apps (.NET)
Free PDF Viewer control for Windows Forms (.NET)
How to integrate PDF Viewer control in WPF app (.NET)
Creating WPF PDF Viewer supporting bookmarks (.NET)
Cross-platform PDF Viewer using GTK# (MONO)
Silverlight PDF viewer control (Silverlight 5)
Multithreaded PDF rendering (.NET)
Convert pdf to image in Silverlight app (C# sample)
How to set fallback fonts for PDF rendering (C#)
Avoiding the out-of-memory exception on rendering (C#)
PDF viewer single page application (WebAPI, AngularJS)
PDF viewer control for Windows 10 universal applications
Use custom ICC profile for CMYK to RGB conversion
PDF layers - separate images, text, annotations, graphics

PDF Forms Creation PDF Security
Conversion to PDF/A
Other topics
PDF Document Manipulation
PDF Content Generation
Fixed and Flow layout document API (.NET)
Creation of grids and tables in PDF (C# sample)
How to create interactive documents using Actions (C# sample)
Text flow effects in PDF (C# sample)
How to generate ordered and bulleted lists in PDF (C# sample)
Convert HTML to PDF using flow layout API (C# sample)
How to use custom fonts for PDF generation (.NET)
Create document with differently sized pages (C#)
Create PDF documents using MONO (C#/MONO/Windows/OSX)
How to use background images for content elements (C#/PDF Kit/FlowLayout)
Add transparent images to PDF document (C#)
Draw round rect borders in PDF documents(C#)
ICC color profiles and and ICC based colors in PDF (C#)
How to use bidirectional and right to left text in PDF (C#)
Create PDF documents from XML templates (C# sample)
How to resize PDF pages and use custom stamps (C#)
Add header and footer to PDF page (.NET sample)
How to use clipping mask for drawing on PDF page
Fill graphics path with gradient brushes in PDF (Shadings)
Apitron PDF Kit and Rasterizer engine settings
Add layers to PDF page (optional content, C# sample)
How to create free text annotation with custom appearance

PDF Content Extraction
PDF Navigation

PDF to TIFF conversion
Contact us if you have a PDF related question and we'll cover it in our blog.

2014-11-19

PDF bookmarks

Intro

Some PDF documents can contain the TOC (table of contents) to simplify navigation within the PDF file and to allow structured content representation. It's the thing you usually see then you click on Bookmarks tab in Acrobat Reader. So this table of contents is usually being created by using bookmark objects (this is the PDF name for such objects as defined in specification). This object supports navigation as well as link (see our older posts: working with build-in navigation and how to work with links in PDF documents) being a bit different.

While the samples listed above provide code and theory for highlighting search results or link targets on PDF page, current sample is designed to show the bookmark basics for the most common task – enumerate bookmarks list and show doc's table of contents.

The code

C# code sample below demonstrates how it could be done using our API.

/// <summary>
/// Demonstrates bookmarks enumeration in PDF file.
/// </summary>
class Program
{
    static void Main(string[] args)
    {
       // open and load the file
       using (FileStream fs = new FileStream(@"..\..\..\Documents\development guide.pdf",                FileMode.Open))
       {
           // this object represents a PDF document
           using(Document document = new Document(fs))
           {
               EnumerateBookmarksAndPrint(document.Bookmarks);
           }
       }

       Console.ReadLine();
     }

     /// <summary>
     /// Enumerates the bookmarks and prints their title.
     /// </summary>
     /// <param name="bookmark">The bookmark.</param>
     private static void EnumerateBookmarksAndPrint(Bookmark bookmark)
     {
         if(bookmark!=null)
         {
             Console.WriteLine(bookmark.Title);

             for(int i=0;i<bookmark.Children.Count;i++)
             {
                 EnumerateBookmarksAndPrint(bookmark.Children[i]);
             }
         }
     }
}

Output

1. Introduction
2. Getting started
2.1 Development environment
2.2 Deployment & installation
2.3 Licensing process
2.3.1 Using custom assembly attribute
2.3.2 Applying license manually
3. Product description
3.1 PDF versions supported
3.2. Features and limitations
3.3. Output formats
3.4 Processing highlights
4. Code samples
4.1. Convert PDF document to Bitmap
4.2. Convert PDF to TIFF
4.3. Viewing information about PDF document
4.4. Extracting font information from PDF files
4.5 Advanced conversion using rendering settings



The sample can be found in our download package and is located in Samples\BookmarksUsage folder.
It's also possible to highlight bookmark's destinaton and save desired PDF page to image using the API provided by Apitron PDF Rasterizer for .NET.