Hi,
I am trying to add a bookmark to a PdfViewer.LoadedDocument and save the content of PdfViewer to a StorageFile, so that the bookmark and the annotations are present in the output file.
Here's my code , where I'm trying to achieve this:
private async void Button_Click(object sender, RoutedEventArgs e)
{
var bookmark = pdfViewer.LoadedDocument.Bookmarks.Add("First page");
bookmark.Destination = new PdfDestination(pdfViewer.LoadedDocument.Pages[0]);
var stream = pdfViewer.Save();
stream.Position = 0;
var fileSavePicker = new FileSavePicker();
fileSavePicker.FileTypeChoices.Add("PDF", new[] { ".pdf" });
var file = await fileSavePicker.PickSaveFileAsync();
using (var fileWriteStream = await file.OpenStreamForWriteAsync())
{
await stream.CopyToAsync(fileWriteStream);
}
}
The output file includes annotations, but it does not include added bookmark.
Could somebody help me to find the solution?
Thanks very much.