We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How do I set zoom level when adding bookmarks to a pdf document?

When adding a bookmark to a PDF document, we use the code below

Dim bmaudit As Aspose.Pdf.Facades.Bookmark = New Aspose.Pdf.Facades.Bookmark()

bmaudit.Action = “GoTo”

bmaudit.Title = “Audit”

bmaudit.PageNumber = liauditpage


When checking the properties of the added bookmarks, it shows us that the zoom level defined on the bookmark is ‘Fit page’ (see first attached file) and what we need as zoom level is ‘Inherit zoom’ (see second attached file)

How can we accomplish that?

Thanks in advance for any feedback,


Hi Kay,

Thanks for your inquiry. Please check following code snippet to set inherit zoom of bookmark. Hopefully it will help you to accomplish the task.

Dim doc As New Document(myDir + “Input.pdf”)<o:p></o:p>

Dim page1 As Page = doc.Pages(1)

Dim bookmark As New OutlineItemCollection(doc.Outlines)

bookmark.Action = New Aspose.Pdf.InteractiveFeatures.GoToAction(doc.Pages(1))

' Set inherit zoom

bookmark.Destination = New XYZExplicitDestination(page1, 0, page1.Rect.Height, 0)

bookmark.Title = "bookmark for page 1"


doc.Save(myDir + "bookmark.pdf")

Please feel free to contact us for any further assistance.

Best Regards,