In Windows 8 I can open up any PDF file in the native new PDF viewer and add notes by highlighting text and clicking “Add a Note”.
I would love to be able to programmatically access these notes using C#. But I am having trouble finding them. I can easily enough enumerate through document properties but I cannot find the notes at all…
Here is my code:
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".pdf");
StorageFile file = await openPicker.PickSingleFileAsync();
var props = await file.Properties.RetrievePropertiesAsync(new List<string> { });
foreach (var key in props.Keys)
{
Debug.WriteLine("key: " + key + " value: " + props[key]);
}
var docProp = await file.Properties.GetDocumentPropertiesAsync();
var allDocProperties = await docProp.RetrievePropertiesAsync(new List<string> { });
foreach (var key in allDocProperties.Keys)
{
Debug.WriteLine("key: " + key + " value: " + allDocProperties[key]);
}
But none of the properties I am seeing in the output window have anything to do with the notes I have created in the PDF.
Can anyone else help me out here?
The result of this was that I had to port over just enough of the code from iTextView into .NETCore, which was a big pain but I got enough of it working so that I can pass in a
byte[]and extract the annotations.Thanks for the help.