I have several pdfs read using PSPDFKit in UWP. While reading the pdf, I encountered a problem, namely: the annotation features appeared, and some did not appear. So the annotation feature doesn't always appear when reading a pdf.
As in some of the pictures below:
The annotation feature don't appear
XAML:
<ui:PdfView
x:Name="pdfViewer"
Grid.Row="0"
License="{StaticResource PSPDFKitLicense}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ShowAnnotations="True"/>
Code:
var document = DocumentSource.CreateFromStorageFile(file);
await pdfViewer.Controller.ShowDocumentAsync(document);
var toolbarItems = pdfViewer.GetToolbarItems();
toolbarItems.RemoveAt(toolbarItems.IndexOf(new PanToolbarItem()));
toolbarItems.RemoveAt(toolbarItems.IndexOf(new PrintToolbarItem()));
toolbarItems.RemoveAt(toolbarItems.IndexOf(new DocumentEditorToolbarItem()));
await pdfViewer.SetToolbarItemsAsync(toolbarItems);
await pdfViewer.Controller.SetZoomModeAsync(ZoomMode.FitToViewPort);
How to make the annotation feature always appear when reading a pdf?
Here are some pdfs that I used as shown in the image: https://1drv.ms/u/s!Av6G8Zq_Px8WhGfhm59Fxd7LWNWa?e=6yNOB9
I am one of the programmers working on PSPDFKit UWP SDK ... I am not 100% sure if the question is about the toolbar icons or something else.
In case it is about the toolbar icons, I would recommend setting the toolbar once, not every time you open a new document. In case you do want to modify the toolbar for each new document, I would recommend checking the value of toolbarItems.IndexOf function call and only if it is bigger or equal to zero, call the toolbarItems.RemoveAt method.
I created a small example for you, please get it here: https://github.com/PSPDFKit-labs/CieloStackOverflowExample
and feel free to change it and come back with more questions in case it doesn't work for you.
Thank you for providing all the data, this was very helpful.
Patrik