Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.
Fri Feb 05, 2016 1:58 pm
Hey,
How do I set the zoom factor for all bookmarks of a PDF-document to "inherit zoom" using Spire.PDF?
Thanks in advance.
Crix
-

Crix
-
- Posts: 4
- Joined: Mon Jan 04, 2016 3:07 pm
Mon Feb 08, 2016 7:49 am
Hello,
Thanks for your inquiry. Sorry that at present Spire.Pdf doesn't support the feature, and I have added it to our schedule, once it is added, we will let you know.
Best Regards,
Gary
E-iceblue support team
-


Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am
Sun Feb 14, 2016 7:52 am
Hello,
By investigating further, you can set the zoom property of bookmark to 0, which is inherit zoom.
- Code: Select all
PdfDocument pdfdoc = new PdfDocument();
pdfdoc.LoadFromFile(fileName);
foreach (var bookMark in pdfdoc.Bookmarks)
{
(bookMark as PdfBookmark).Destination.Zoom = 0;
}
Sincerely,
Gary
E-iceblue support team
-


Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am
Mon Feb 15, 2016 8:12 am
Just a quick follow up to see how this issue is now? Has it been resolved?
Thanks,
Gary
E-iceblue support team
-


Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am
Mon Feb 15, 2016 1:20 pm
Hey Gary,
Thank you for your investigations. Unfortunately I did not get it to work. The bookmarks of my Test-PDF remain as "Fit Page". Also, when re-running the code on the same document I get a System.NullReferenceException (Bookmark.Destination = Nothing). Here is what i have got: (VB.NET)
- Code: Select all
Private Sub SetInheritZoom(FileName As String)
Dim Document As New PdfDocument()
Document.LoadFromFile(FileName)
For Each Bookmark As Bookmarks.PdfBookmark In Document.Bookmarks
Bookmark.Destination.Zoom = 0 'System.NullReferenceException
Next Bookmark
Document.SaveToFile(FileName)
Document.Close()
Process.Start(FileName)
End Sub
What did I do wrong?
-

Crix
-
- Posts: 4
- Joined: Mon Jan 04, 2016 3:07 pm
Tue Feb 16, 2016 2:01 am
Hello,
Thanks for your response. Could you please attach your test document here for our testing.
Thanks in advance,
Gary
E-iceblue support team
-


Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am