I have a UWP app where I export the annotations. I then import those annotations into the Blazor version of the app. If I look at the result of
object JsonResult = pdfviewer.ImportAnnotation(jsonObject);
in PdfViewerController.ImportAnnotations, it seems that the FreeText annotation is incorrectly referenced as a Signature Annotation. I have tried a few other types of annotations and they seem to work fine.
Regards,
Arthur
Here is what I am doing. Is this correct? Should I be doing this differently.
In the Xamarin UWP app, I do this:
Stream fdfStreamToSave = await _pdf_viewer.ExportAnnotationsAsync(AnnotationDataFormat.XFdf, System.Threading.CancellationToken.None);
byte[] result;
if (fdfStreamToSave is MemoryStream)
{
result = ((MemoryStream)fdfStreamToSave).ToArray();
}
else
{
result = readFully(fdfStreamToSave);
}
string annotations = Convert.ToBase64String(result); // in the real app, this will get saved in the database
Then, in PdfViewerController.cs (web service used by the Blazor app), do this where annotations is the base64 string from the UWP app which would come from the database in a real app.
var annotations = "77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjx4ZmRmIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vbnMuYWRvYmUuY29tL3hmZGYvIj4NCiAgPGFubm90cz4NCiAgICA8dW5kZXJsaW5lIHBhZ2U9IjEiIG9wYWNpdHk9IjAuNDk4MDM5MiIgcmVjdD0iNzEuNzYwMDYsNTk3LjQ5MTMsMjYxLjYzMDQsNjA5LjAxMTMiIGZsYWdzPSJwcmludCIgY29vcmRzPSI3MS43NjAwNiw2MDkuMDExMywyNjEuNjMwNCw2MDkuMDExMyw3MS43NjAwNiw1OTcuNDkxMywyNjEuNjMwNCw1OTcuNDkxMyIgY29sb3I9IiMwMEZGMDAiIHdpZHRoPSIxIiBib3JkZXI9IjAsMCwxIiAvPg0KICAgIDxoaWdobGlnaHQgcGFnZT0iMSIgb3BhY2l0eT0iMC40OTgwMzkyIiByZWN0PSI3MS43NjAwNyw1NzMuMTMyNiwyMjQuNzI5OCw1ODQuNjUyNiIgZmxhZ3M9InByaW50IiBjb29yZHM9IjcxLjc2MDA3LDU4NC42NTI2LDIyNC43Mjk4LDU4NC42NTI2LDcxLjc2MDA3LDU3My4xMzI2LDIyNC43Mjk4LDU3My4xMzI2IiBjb2xvcj0iI0ZGRkYwMCIgd2lkdGg9IjEiIGJvcmRlcj0iMCwwLDEiIC8+DQogICAgPGZyZWV0ZXh0IHBhZ2U9IjEiIHJlY3Q9IjQ2Ny4yMzQ2LDcwNS41NTQ0LDQ5Ni4zNzMzLDcyMy4wMTU0IiByb3RhdGlvbj0iMCIgYm9yZGVyPSIwLDAsMCIgZmxhZ3M9InByaW50IiBmcmluZ2U9IjAsMCwwLDAiIHE9IjAiIElUPSJGcmVlVGV4dENhbGxvdXQiIGhlYWQ9Ik5vbmUiPg0KICAgICAgPGRlZmF1bHRhcHBlYXJhbmNlPjAgMCAwIHJnIDwvZGVmYXVsdGFwcGVhcmFuY2U+DQogICAgICA8ZGVmYXVsdHN0eWxlPmZvbnQ6SGVsdmV0aWNhIDEycHQ7c3R5bGU6UmVndWxhcjsgY29sb3I6IzNENTlGMTwvZGVmYXVsdHN0eWxlPg0KICAgICAgPGNvbnRlbnRzPkhlbGxvPC9jb250ZW50cz4NCiAgICA8L2ZyZWV0ZXh0Pg0KICA8L2Fubm90cz4NCiAgPGYgaHJlZj0iIiAvPg0KPC94ZmRmPg==";
jsonObject["importedData"] = annotations;
object JsonResult = pdfviewer.ImportAnnotation(jsonObject);
return Content(JsonConvert.SerializeObject(JsonResult));
I create the annotation on the Xamarin.Forms app. I do not see any API for setting Author in the Xamarin app. I then import those annotations into the Blazor app. This is where the free-text annotation gets imported incorrectly.
Regards,
Arthur
|
Blazor Client |
|
|
Blazor Sever |
|
|
Service side package |
ASP.NET Core :
https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows/
https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux/ ASP.NET MVC:
|