Hello,
I have to store annotations separately in xfdf file, after a user complete editing, the user can export pdf document with annotations, so I have to merge them:
File document = new File(mDocumentPath);
File annotations = new File(mAnnotationsPath);
if (annotations.exists()) {
try {
PDFDoc doc = new PDFDoc(new FileInputStream(document));
FDFDoc fdf = FDFDoc.createFromXFDF(mAnnotationsPath);
doc.fdfMerge(fdf);
doc.flattenAnnotations(true);
doc.save(mResultFilePath, SDFDoc.e_linearized, null);
doc.close();
fdf.close();
} catch (Exception e) {
e.printStackTrace();
}
}
The issue is: some 3rd party pdf viewers cannot display the annotations in the pdf file.
App name
|
Supported
|
Play Store
|
- | - | - |
Google PDF Viewer
|
-
|
https://play.google.com/store/apps/details?id=com.google.android.apps.pdfviewer
|
Google Drive Pdf Viewer
|
-
|
https://play.google.com/store/apps/details?id=com.google.android.apps.docs
|
Adobe Reader
|
-
|
https://play.google.com/store/apps/details?id=com.adobe.reader
|
Foxit Reader
|
+
|
https://play.google.com/store/apps/details?id=com.foxit.mobile.pdf.lite
|
EBookDroid
|
+
|
https://play.google.com/store/apps/details?id=org.ebookdroid
|
PDF Reader
|
-
|
https://play.google.com/store/apps/details?id=pdf.reader
|
PDF Reader
|
+
|
https://play.google.com/store/apps/details?id=com.foobnix.pdf.reader
|
I changed the ‘flatten’ flag to false:
doc.flattenAnnotations(false);
and it works, all these viewers display annotations (highlight, strikeout, underline, custom drawing) correctly.
But, unfortunately, the ‘note’ annotations aren’t working.
I see only a icon in the pdf file, but can’t read or edit the note (see attached file).
Could you help me? Perhaps, I’m doing something wrong.
Thanks.