Special Characters in xfdf

164 views
Skip to first unread message

epo...@gmail.com

unread,
Mar 24, 2014, 2:56:38 PM3/24/14
to pdfne...@googlegroups.com

Hi,

I use PDFNet for WinRT version 8.1_6.2.1

I need to extract the annotations from my PdfDoc and save them.

FDFDoc fdf = doc.FDFExtract(PDFDocExtractFlag.e_both);
var s = fdf.SaveAsXFDFString();

byte[] stream= System.Text.Encoding.UTF8.GetBytes(s);


When I added special characters in the annotation, they are modified

For example,

- My annotation : 

Mie duis venesatis amèt taciti donéc dui, rhoncüs morbié blandit lobortïs quis bibendum, gravida nîbh variûs leçtus.

- The s variable :

s = "<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="
http://ns.adobe.com/xfdf/" xml:space="preserve">
 
<annots>
 
<text color="#FE01FE0100" creationdate="D:20140324162516Z00'00'" flags="print,nozoom,norotate" date="D:20140324162516Z00'00'" name="43a93a79-89a0-494d-9bb1-2e0369b53b53" icon="Comment" page="0" rect="164.207762,789.464202,184.207762,809.464202">
 
<popup date="D:20140324162516Z00'00'" page="0" rect="164.207762,789.464202,184.207762,809.464202">
 
</popup>
 <contents>
Mie duis venesatis amèt taciti donéc dui, rhoncüs morbié blandit lobortïs quis bibendum, gravida nîbh variûs leçtus.</contents>
 
</text>
 </
annots>
 
<pages>
 
<defmtx matrix="1.333333,0.000000,0.000000,-1.333333,0.000000,1121.280000">
 
</defmtx>
 </
pages>
</xfdf>"


After saving the document, I open the pdf, then this annotation :

var s = System.Text.Encoding.UTF8.GetString(stream, 0, stream.Length);
f
= await FDFDoc.CreateFromXFDFAsync(s);

doc
.FDFMerge(f);

and it becomes : 

Mie duis venesatis am\U00C3\U0083\U00C2\U00A8t taciti don\U00C3\U0083\U00C2\U00A9c dui, rhonc\U00C3\U0083\U00C2\U00BCs morbi\U00C3\U0083\U00C2\U00A9 blandit lobort\U00C3\U0083\U00C2\U00AFs quis bibendum, gravida n\U00C3\U0083\U00C2\U00AEbh vari\U00C3\U0083\U00C2\U00BBs le\U00C3\U0083\U00C2\U00A7tus.

How could I correct that ? 


Tomas Hofmann

unread,
Mar 26, 2014, 2:16:19 PM3/26/14
to pdfne...@googlegroups.com
Hi there,

Thanks for bringing this to our attention. We are currently looking into this issue.
Note that using FDFDoc.SaveAsXFDFAsync(string filepath) works correctly still, so it might be possible to use the Temporary or Local folders of your app to save the XFDF data.
e.g.
private string XFDF_LOCATION = Path.Combine(ApplicationData.Current.LocalFolder.Path, "annots.xfdf");

And then save and load from XFDF_LOCATION.

We will investigate the issue when saving as XFDF string or when saving to a filter, as they seem to have the same problem. We should be able to give you a build without these problems by the end of the week.
Please email us at support (at) pdftron (dot) com if you would like to receive a build with this fix.

Best Regards,
Tomas Hofmann
Reply all
Reply to author
Forward
0 new messages