Hello,
i'm trying to add bookmarks to a merged document. I've searched the forum and tried several suggestions, but the merged PDF does not contain any bookmarks.
Maybe i'm missing something...
In my example i want to have bookmarks to the first pages of 1.pdf, 3.pdf and 4.pdf...
Here's the code i'm using:
Dim mdoc As Merger.MergeDocument = New Merger.MergeDocument()
Dim pageList As New List(Of Integer)
mdoc.Append("D:\Index.pdf")
pageList.Add(mdoc.Pages.Count)
mdoc.Append("D:\1.pdf")
mdoc.Append("D:\2.pdf")
pageList.Add(mdoc.Pages.Count)
mdoc.Append("D:\3.pdf")
pageList.Add(mdoc.Pages.Count)
mdoc.Append("D:\4.pdf")
For i As Integer = 0 To pageList.Count - 1
mdoc.Pages(pageList(i)).Elements.Add(New Bookmark("Page " & pageList(i), 0, 0))
Next
mdoc.Draw("D:\output.pdf")
Adding Bookmarks to merged document
Re: Adding Bookmarks to merged document
Forum member · Jan 25, 2018I did another test with the above code, just took out 3.pdf and 4.pdf as they already contain bookmarks.
It then worked with the code above.
If i include the PDFs with the bookmarks, i can't add bookmarks to the other pages at all and the bookmarks from 3.pdf and 4.pdf are gone.
Re: Adding Bookmarks to merged document
Support · Jan 25, 2018Hello,
Please send over the following details to [^a|mailto:support@cete.com|opennewwindow|support@cete.com^] so we can look into the issue further.
1. Input PDFs.
2. Output PDF.
3. Exact version and build number of the DynamicPDF DLL file. You can get this information in DLL reference properties (Version and Description fields) in Visual Studio.
Thanks,
ceTe Software Support Team.
Re: Adding Bookmarks to merged document
Support · Jan 25, 2018Hello Maren,
Since you don’t need the existing bookmarks in documents 3 and 4 I suggest you avoid importing them as shown below using MergeOptions class. This should resolve the issue you are experiencing.
Dim mdoc As Merger.MergeDocument = New Merger.MergeDocument()
Dim pageList As New List(Of Integer)
Dim options As MergeOptions = New MergeOptions()
options.Outlines = False
mdoc.Append("D:\Index.pdf")
pageList.Add(mdoc.Pages.Count)
mdoc.Append("D:\1.pdf")
mdoc.Append("D:\2.pdf")
pageList.Add(mdoc.Pages.Count)
mdoc.Append("D:\3.pdf", options)
pageList.Add(mdoc.Pages.Count)
mdoc.Append("D:\4.pdf", options)
For i As Integer = 0 To pageList.Count - 1
mdoc.Pages(pageList(i)).Elements.Add(New Bookmark("Page " & pageList(i), 0, 0))
Next
mdoc.Draw("D:\output.pdf")
Thanks,
ceTe Software Support Team.
Re: Adding Bookmarks to merged document
Forum member · Jan 25, 2018This worked for me, thank you very much :)
I hope you manage to find the problem so pdfs can be merged regardless of them having bookmarks or not.