public static void Main() { Console.WriteLine("libhpdf-" + HPdfDoc.HPdfGetVersion()); try { HPdfDoc pdf = new HPdfDoc(); pdf.SetCompressionMode(HPdfDoc.HPDF_COMP_ALL); /* create default-font */ HPdfFont font = pdf.GetFont("Helvetica", null); pdf.SetPageMode(HPdfPageMode.HPDF_PAGE_MODE_USE_OUTLINE); /* add a new page object. */ /* Add 3 pages to the document. */ HPdfPage page0 = pdf.AddPage(); page0.SetFontAndSize(font, 30); PrintPage(page0, 1); HPdfPage page1 = pdf.AddPage(); page1.SetFontAndSize(font, 30); PrintPage(page1, 2); HPdfPage page2 = pdf.AddPage(); page2.SetFontAndSize(font, 30); PrintPage(page2, 3); /* create outline root. */ HPdfOutline root = pdf.CreateOutline(null, "OutlineRoot", null); root.SetOpened(true); HPdfOutline outline0 = pdf.CreateOutline(root, "page1", null); HPdfOutline outline1 = pdf.CreateOutline(root, "page2", null); /* create outline with test which is ISO8859-2 encoding */ HPdfOutline outline2 = pdf.CreateOutline(root, "ISO8859-2 text гдежзий", pdf.GetEncoder("ISO8859-2")); /* create destination objects on each pages * and link it to outline items. */ HPdfDestination dst = page0.CreateDestination(); dst.SetXYZ(0, page0.GetHeight(), 1); outline0.SetDestination(dst); dst = page1.CreateDestination(); dst.SetXYZ(0, page1.GetHeight(), 1); outline1.SetDestination(dst); dst = page2.CreateDestination(); dst.SetXYZ(0, page2.GetHeight(), 1); outline2.SetDestination(dst); /* save the document to a file */ pdf.SaveToFile("OutlineDemo.pdf"); } catch (Exception e) { Console.Error.WriteLine(e.Message); } }