I am creating a simple bookmark into this PDF using Aspose.PDF version 25.3.0.0:
Document newDoc = new Document();
newDoc.Pages.Add();
var pdfOutline = new Aspose.Pdf.OutlineItemCollection(newDoc.Outlines);
pdfOutline.Title = "Test Outline";
pdfOutline.Action = new Aspose.Pdf.Annotations.GoToAction(newDoc.Pages[1]);
newDoc.Outlines.Add(pdfOutline);
newDoc.Save("test.pdf");
However, when I extract the bookmark using an older version of Aspose (19.1.0.0)
PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
bookmarkEditor.BindPdf(newDoc);
Bookmarks bookmarks = bookmarkEditor.ExtractBookmarks();
Console.WriteLine(bookmarks[0].Title);
//output is ÿþTest Outline
The output of the Title contains a few special characters in the beginning. “ÿþTest Outline”
Why are there special characters being output from the older version of Aspose and how can i fix it without upgrading the old version of aspose (19.1.0.0)?
I tried extracting the bookmark with other PDF libraries as well and they also output it with the special characters “ÿþ” at the beginning of each bookmark.