I am trying to create a pdf to combine data from database and appending multiple uploaded files. I need create bookmarks for the uploaded files. That is what I did. Got data from database, appendPage with all the uploaded files. Save as a pdf. then open the saved pdf again. Go find My CV and try to created a link to this place. Here is the code.
Dim str as string =""
For Each page As PdfPageBase In doc.Pages
str = page.ExtractText()
If Instr(str,"My CV")=0 then
Dim BookMark As PdfBookmark = doc.Bookmarks.Add("CV")
Dim BookmarkDest As New PdfDestination(page, New Point(0, 0))
BookMark1.DisplayStyle = PdfTextStyle.Bold
BookMark1.Action = New PdfGoToAction(BookmarkDest)
End If
Next page
The issues I got
1. Got error complain Dim BookmarkDest As New PdfDestination(page, New Point(0, 0)) Object not reference. I though the page already defined.
if I changed the code like this
page = doc.Pages.Add(PdfPageSize.A4, margin)
Dim BookMark As PdfBookmark = doc.Bookmarks.Add("CV")
Dim BookmarkDest As New PdfDestination(page, New Point(0, 0))
BookMark1.DisplayStyle = PdfTextStyle.Bold
BookMark1.Action = New PdfGoToAction(BookmarkDest)
2. Create more than one bookmark.