Skip Navigation Links.
In this demo you learn how to automatically create outlines, HTTP and internal links in PDF and how to force a HTML element to start on a new page in PDF.

The demo creates a simple table of contents with internal links to chapters and a HTTP link to HiQPdf website. For each chapter there is also an outline in document outlines and each chapter is forced to start on a new PDF page using the page-break-before : always style.
Server Settings
IP: Port: Password:
Skip Navigation Links
C# Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using HiQPdfClient;

namespace HiQPdf_Demo
    public partial class AutoOutlinesAndLinks : System.Web.UI.Page
        protected void buttonCreatePdf_Click(object sender, EventArgs e)
            string serverIP = textBoxServerIP.Text;
            uint serverPort = uint.Parse(textBoxServerPort.Text);
            string serverPassword = textBoxServerPassword.Text;

            // create the HTML to PDF converter
            HtmlToPdf htmlToPdfConverter = new HtmlToPdf(serverIP, serverPort);

            // use server password if necessary
            if (serverPassword.Length > 0)
                htmlToPdfConverter.ServerPassword = serverPassword;

            // set a demo serial number
            htmlToPdfConverter.SerialNumber = "YCgJMTAE-BiwJAhIB-EhlWTlBA-UEBRQFBA-U1FOUVJO-WVlZWQ==";

            if (checkBoxHierarchical.Checked)
                // automatically outline the H1 to H6 tags in a hierarchy
                htmlToPdfConverter.Document.Outlines.OutlineHeadingTags = true;
                // create outlines for each chapter and for table of contents
                // the CSS selectors mean all the H1 and H2 elements with the CSS class name 'pdf_outlines'
                htmlToPdfConverter.Document.Outlines.OutlinedElements = new string[] { "H1[class=\"pdf_outlines\"]", "H2[class=\"pdf_outlines\"]" };

            // make the outlines visible in viewer
            htmlToPdfConverter.Document.Viewer.PageMode = PdfPageMode.Outlines;

            // convert the HTML code to PDF
            byte[] pdfBuffer = htmlToPdfConverter.ConvertHtmlToMemory(textBoxHtmlCode.Text, null);

            // inform the browser about the binary data format
            HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");

            // let the browser know how to open the PDF document, attachment or inline, and the file name
            HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename=AutoOutlines.pdf; size={0}",

            // write the PDF buffer to HTTP response

            // call End() method of HTTP response to stop ASP.NET page processing

        protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)