Hi,
Is it possible to merge annotations with pdf document in pdfViewer by code ?
Thanks.
Hi,
This is not exactly what I want.
I need merge pdf document and annotations for have possibility of download the pdf document with annotations in an unique pdf file.
Viewer.DownloadAsync();
Note: It will download the PDF document directly into the downloads folder.
|
Ok, I understood, but merge 2 differents pdf it's not what I need.
In my case, I would take a pdf file in database, add annotations with pdfViewer, and update the pdf file with annotations to database.
The ideal case would be a method like this :
var pdfDocWithAnnotations = Syncfusion.Pdf.PdfDocument.Merge(pdfDocument, jsonAnnotations);
(with pdfDocument is the pdf file in pdfViewer)
Thanks.
<SfButton OnClick="ImportAnnotationFromFile">ImportAnnotation1</SfButton>
<SfButton OnClick="ExportAnnotationFile">ExportAnnotation</SfButton>
<SfButton OnClick="ImportAnnotationJson">ImportAnnotationJson</SfButton>
<SfButton OnClick="ExportAnnotationJson">ExportAnnotationJson</SfButton>
@code {
Stream annotationData;
private void ImportAnnotationFromFile()
{
pdfviewer.ImportAnnotation("wwwroot/data/Import1.json", AnnotationDataFormat.Json); // Need to place the imported data in specified folder
}
private async void ExportAnnotationJson()
{
annotationData = await pdfviewer.ExportAnnotationAsStream(AnnotationDataFormat.Json);
}
private void ImportAnnotationJson()
{
pdfviewer.ImportAnnotation(annotationData, AnnotationDataFormat.Json);
}
private void ExportAnnotationFile()
{
pdfviewer.ExportAnnotation();
}}
|
byte[] data;
data = await pdfviewer.GetDocument();
//PDF document file stream
Stream stream = new MemoryStream(data);
|
This solution is ok for me.
Thanks.