Free Support Forum - aspose.com

Bookmark "Fit to Width" default

Hello,

We use PdfBookmarkEditor.CreateBookmarkOfPage method to create bookmarks for a PDF merged document. Prior to this new method, we used same method name but from Pdf.Kit.PdfContentEditor. The older method defaulted the bookmarks to “fit to width” which is what we want. The new method defaults to “fit to page”. Is there any way to have the bookmarks default with “fit to width”?

Thanks,

Yong Kim


Hi Yong,


Thanks for using our products.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34993. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

Hi Yong,


Thanks for your patience. Please check following code snippet. Hopefully it will help you to achieve your requirements. FitHExplicitDestination() method will set bookmark to open “Fit to Width” and FitExplicitDestination() method for “Fit to page”.

Document doc = new Document(inputFile);
Page page1 = doc.Pages[1];

OutlineItemCollection bookmark = new OutlineItemCollection(doc.Outlines);
// Bookmarks open fit to width
bookmark.Destination = new FitHExplicitDestination(page1, page1.Rect.Height);
// Bookmarks open fit to page
// bookmark.Destination = new FitExplicitDestination(page1);
bookmark.Title = “bookmark for page 1”;
doc.Outlines.Add(bookmark);
doc.Save(outputFile);

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-34993) have been fixed in Aspose.Pdf for .NET 7.9.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.