Ok,
as it is not possible, I look at XFDF documents.
I save my annotation in XFDF and I can merge this annotation with my original pdf.
But I want to delegate the saving (for Encryption) and the opening (for decryption) to my service.
FDFDoc fdf = doc.FDFExtract(PDFDocExtractFlag.e_both);
var outputFilePath = Path.Combine(path, "File1.xfdf");
fdf.SetPdfFileName(outputFilePath);
var s = fdf.SaveAsXFDF();
//My method to save
WriteFile("File1.xfdf", s);
then I open my pdf and merge with File1.xfdf.
If I open directly my file without my service, it's ok :
String input_file_path = filefdf.Path;
FDFDoc fdf_doc1 = new FDFDoc(FDFDoc.CreateFromXFDF(input_file_path));
doc.FDFMerge(fdf_doc1);
If I use my service ReadFile
byte[] bytexfdf = ReadFile("File1.xfdf");
FDFDoc fdfDoc = new FDFDoc(bytexfdf, bytexfdf.Length);
I have this error :
WinRT information: Exception:
Message: Header not found
Conditional expression: false
Filename : Parser.cpp
Function : trn::SDF::Parser::SkipHeader
Linenumber : 718
How could I create a FDFDoc with a stream of xfdf file ?