BOOKMARK POINTING EXAMPLE

The following .NET application has been developed using ABCpdf, ASP.NET, and the C# language.

This ABCpdf example creates a PDF document that adds bookmark pointing to the current page.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Text;
using System.Net;
using System.IO;
using WebSupergoo.ABCpdf8;

namespace ABCpdfExamples
{
    public partial class test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {           
            // ---- Adds a bookmark pointing to the current page ----
            Doc doc = new Doc();
            doc.FontSize = 64;
            string theSection, theChapter, theSubject;
            for (int i = 1; i < 3; i++)
            {
                doc.Page = doc.AddPage();
                theSection = i.ToString() + " Section";
                doc.AddText(theSection);
                doc.AddBookmark(theSection, true);
            for (int j = 1; j < 5; j++)
                {
                    doc.Page = doc.AddPage();
                    theChapter = theSection + "\\" + j.ToString() + 
                    " Chapter";
                    doc.AddText(theChapter);
                    doc.AddBookmark(theChapter, false);
                    for (int k = 1; k < 6; k++)
                    {
                        doc.Page = doc.AddPage();
                        theSubject = theChapter + "\\" + k.ToString() + 
                        " Subject";
                        doc.AddText(theSubject);
                        doc.AddBookmark(theSubject, true);
                    }
                }
            }

            doc.Save(Server.MapPath("~/Results/Output.pdf"));
            doc.Clear();
        }
    }
}

Bookmark Pointing

© 1997-2021    Codehacker - All Rights Reserved