VB.NET PDF - Edit PDF Bookmark and Outline in VB.NET
Empower Your VB.NET Project with Rapid PDF Internal Navigation Via Bookmark and Outline
Look for HTML5 PDF Editor?
EdgePDF:
ASP.NET PDF Editor is the best HTML5 PDF Editor and
ASP.NET PDF Viewer based on XDoc.PDF, JQuery, HTML5.
It supports
ASP.NET MVC and WebForms projects.
Free Visual Studio .NET PDF bookmark edit SDK library for navigation in VB.NET
Able to view bookmark in adobe PDF document without adobe PDF reader component in Visual Basic .NET program
Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
Help to add or insert bookmark and outline into PDF file in .NET WinForms and ASP.NET application
Ability to remove and delete bookmark and outline from PDF document in VB.NET class
Export Microsoft Office Word, Excel and PowerPoint bookmark to PDF bookmark
Merge and split PDF file with bookmark in VB.NET
Save PDF file with bookmark open in VB.NET project
PDF control free download for quick evaluation in .NET framework program
Online source codes are accessible for using in VB.NET class
As a powerful PDF editing control, RasterEdge XDoc.PDF SDK package provides PDF file navigation features for your VB.NET project. On this tutorial, VB.NET users can learn how to retrieve and update PDF bookmark or outline. Users can get a quick evaluation by using following sample code.
VB.NET Project: DLLs for Bookmark Edit
In order to run the sample code, the following steps would be necessary.
Add necessary references:
RasterEdge.Imaging.Basic.dll
RasterEdge.Imaging.Basic.Codec.dll
RasterEdge.Imaging.Drawing.dll
RasterEdge.Imaging.Font.dll
RasterEdge.Imaging.Processing.dll
RasterEdge.XDoc.Raster.dll
RasterEdge.XDoc.Raster.Core.dll
RasterEdge.XDoc.PDF.dll
Use corresponding namespaces;
using RasterEdge.Imaging.Basic;
using RasterEdge.XDoc.PDF;
VB.NET: Retrieve PDF Document Outline
Please directly copy and paste VB.NET demo code below to your project to retrieve PDF file outline.
' Retrieve PDF document outline.
Dim inputFilePath As String = Program.RootPath + "\\" + "2.pdf"
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim outline As REOutline = doc.GetOutline()
For Each entry As REEntry In outline.Entry
Console.WriteLine("Page: {0}", entry.GetPageIndex())
Console.WriteLine("Level: {0}", entry.GetLevel())
Console.WriteLine("Position: {0}", entry.GetLocation())
Console.WriteLine("Text: {0}", entry.GetText())
Next
|
VB.NET: Update PDF Document Outline
Or you can also edit and update PDF document outline as below.
Dim inputFilePath As String = Program.RootPath + "\\" + "2.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "Output_Outline.pdf"
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' Initial a new outline object.
Dim outline As REOutline = New REOutline()
' Create 1st entry: Level = 1; Location: page index 0, y = 50.
Dim entryChapter1 As Outline = New Outline("Chapter 1: *******", 1, 0, 50)
' Add 1st entry to outline.
outline.Entry.Add(entryChapter1)
' Create 1st entry's child entries.
' Create 1st child entry: Level = 2; Location: page index 1, y = 0.
Dim entryChapter11 As Outline = New Outline("###### #### #### #### ###", 2, 1, 0)
' Connect this entry to the parent entry.
entryChapter11.SetParentREEntry(entryChapter1)
' Add 1st child of 1st entry to outline.
outline.Entry.Add(entryChapter11)
' Create 2nd child entry: Level = 2; Location: page index 2, y = 0.
Dim entryChapter12 As OutLine = New OutLine("## ## ## ## ## #### ###", 2, 2, 0)
' Connect this entry to the parent entry.
entryChapter12.SetParentREEntry(entryChapter1)
' Add 2nd child of 1st entry to outline.
outline.Entry.Add(entryChapter12)
' Create 2nd entry: Level = 1; Location: page index 3, y = 100.
Dim entryChapter2 As OutLine = New OutLine("Chapter 2: ******* ****", 1, 3, 100)
' Add 2nd entry to outline.
outline.Entry.Add(entryChapter2)
' Create 3rd entry: Level = 1; Location: page index 5, y = 200.
Dim entryChapter3 As OutLine = New OutLine("Chapter 3: **** **** ***", 1, 5, 200)
' Add 3rd entry to outline.
outline.Entry.Add(entryChapter3)
' Create 3rd entry's child entries.
' Create 1st child entry: Level = 2; Location: page index 9, y = 0.
Dim entryChapter31 As OutLine = New OutLine("# #### ###", 2, 9, 0)
' Connect this entry to the parent entry.
entryChapter31.SetParentREEntry(entryChapter3)
' Add 1st child of 3rd entry to outline.
outline.Entry.Add(entryChapter31)
' Create a child entry for the 1st child entry of the 3rd entry.
' Create entry: Level = 3; Location: page index 9, y = 500.
Dim entryChapter311 As OutLine = New OutLine("???? ???? ??? ???", 3, 9, 500)
' Connect this entry to the parent entry.
entryChapter311.SetParentREEntry(entryChapter31)
' Add 1st child of 3rd entry to outline.
outline.Entry.Add(entryChapter311)
' Create 4th entry: Level = 1; Location: page index 10, y = 0.
Dim entryChapter4 As OutLine = New OutLine("Chapter 4: ******* ** ** **** ***", 1, 10, 0)
' Add 4th entry to outline.
outline.Entry.Add(entryChapter4)
' Create 5th entry: Level = 1; Location: page index 20, y = 0.
Dim entryChapter5 As OutLine = New OutLine("Chapter 5: * ** **** **** ****", 1, 20, 0)
' Add 5th entry to outline.
outline.Entry.Add(entryChapter5)
' Update the new outline.
doc.SetOutline(outline)
doc.Save(outputFilePath)
|