If you just want to save the Annotations, I think you want to take a look at XFDF documents. It’s basically a XML document with annotation information. You can take a look at the FDFTest sample in the PDFNetWinRTSamples project for a demo on how to use this. You can export annotations from a PDF document and then save them as XFDF.
If this does not solve your problem, could you please add some details as to what your scenario looks like, and we will be happy to help.
Thanks for your answers,
This is exactly what I need, but I don’t find this method in SDK for windows store app,
I have only this 3 methods :
public void Save(string path, SDFDocSaveOptions flags);
public IAsyncAction SaveAsync(SDFDocSaveOptions flags);
public IAsyncAction SaveAsync(IStorageFile path, SDFDocSaveOptions flags);
I need to save my document, with all annotations in a Stream and send this stream to other service for encryption.
Do you know how I can get a stream with PDFDoc without creating a local file?
Le mercredi 19 février 2014 18:59:08 UTC+1, Aaron Gravesdale a écrit :
Note that, if you’re simply asking how to save a modified PDFDoc to a stream instead of a file, you can do so with the following API:
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 ?
FYI : The extra Save() method(s) will be added as part of PDFNet v.6.2 (to be released in first weeks of March).
In the meantime you could load XFDF from a string: