Search code examples
vb.netabcpdf

abcpdf doesnt add bookmark when you append a pdf from a url


Dim mainDoc As New WebSupergoo.ABCpdf8.Doc()
Dim pdfDoc As New WebSupergoo.ABCpdf8.Doc()
mainDoc.Append(pdfDoc) 'merge page one
mainDoc.Page = mainDoc.AddPage()
mainDoc.AddHtml("<P><B>Description:</B>  Sample Desc </P><BR><BR>")
mainDoc.AddBookmark("1 Intro", True)
mainDoc.Page = mainDoc.AddPage()
mainDoc.AddHtml("<P><B>second page:</B>  Sample Desc </P><BR><BR>")
mainDoc.AddBookmark("1 second page", True)

'Everything fine till this
Dim testDoc As New WebSupergoo.ABCpdf8.Doc()
testDoc.Read("www.google.com")
mainDoc.Append(testDoc)
mainDoc.AddBookmark("3 Google page", True) 

'The last google page bookmark is not working, always pointing to the First page (Intro)

Can anyone help me with this...?. I want to append a doc and add bookmark to it.

Thanks Anbu


Solution

  • Got it working. Need to specify the pagenumber for the maindoc before adding bookmark.

    Dim pageNum =  mainDoc.PageCount
    Dim testDoc As New WebSupergoo.ABCpdf8.Doc()
    testDoc.Read("www.google.com")
    mainDoc.Append(testDoc)
    mainDoc.PageNumber = pageNum +1
    mainDoc.AddBookmark("3 Google page", True)