1

I am developing an Android PDF reader (That is Read Only).

I have external annotations that are defined using a proprietary format as the pdf files they are associated with are consumed both in a web and desktop application.

these web and desktop applications can add, remove, & update annotations where the android companion app can only display annotations.

the annotations are held outside the pdf document with the annotations colour, type, dimensions and location all being defined in a proprietary format.

I would like to be able to import these annotations into their associated pdf document via XFDF format file or a string that contains XFDF formate definitions for annotations.

where can i find the definition for XFDF or FDF files (strings) ?

is there an industry standard library for generating XFDF/FDF files i can employ in my android application to convert from my proprietary annotation format to XFDF format?

Hector
  • 4,016
  • 21
  • 112
  • 211
  • 1
    A down-to-earth straight forward approach I often use, is to create the annotations, and export them; that will lead to the pattern, such annotations will have to have. there is also a section about FDF in the Acrobat SDK documentation (the PDF description of version 1.7 is sufficient; for newer documentation, you'd have to shell out some money to your national ISO Standards representatives. – Max Wyss Feb 28 '23 at 17:31
  • @KJ, the format is simple I agree, however knowing what the values represent is another mater, e.g. for example rect="12.34,56.78,90.11,21.31" what are the values lower left (x,y) upper right (x,y) or what? similarly for coords="11.11,22.22,33.33,44.44,55.55,66.66,77.77,88.88" what are these sets of 8 values, what coords are they? – Hector Feb 28 '23 at 20:19
  • @KJ, i am not interested in fields just annotations of highlights and/or text notes. – Hector Mar 01 '23 at 15:07
  • 1
    @Hector Is there any way you can merge the annotations into the PDF document with your proprietary format? If so, you can then use Apryse SDK to extract the XFDF properly instead of having to create them. – Shirley G Mar 01 '23 at 17:53

1 Answers1

1

The definitive "Manual" / "User Guide" is https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#page=411

So this text file will on opening (in an Adobe compliant PDF reader)

%FDF-1.4
%âãÏÓ

1 0 obj
<<
/FDF <</Annots [2 0 R 3 0 R]/F (blank.pdf)/UF (blank.pdf)>>/Type /Catalog
>>
endobj

2 0 obj
<<
/C [1 1 0]/Contents (Hello World!)/F 4/M (D:20230301)/NM (12345678-1234-1234-1234567890123456)
/Page 0/Popup 3 0 R
/QuadPoints [36 792 180 792 36 756 180 756]
/RC (<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:10.1.5" xfa:spec="2.1" style="text-align:left;line-height:normal;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;color:#000000;text-valign:top;">
<p><span>Hello World!</span></p></body>)
/Rect [36 756 180 792]/Subtype /Highlight/Type /Annot
>>
endobj

3 0 obj
<<
/F 28/M (D:20230301)/NM (2ee012cf-1c67-4434-91afce778705a2f4)
/Open true/Page 0/Parent 2 0 R/Rect [48 792 156 840]/Subtype /Popup/Type /Annot
>>
endobj

trailer
<<
/Root 1 0 R
>>
%%EOF

Will be able to draw all these objects.

![enter image description here

If we strip it to the bone its almost as good (OR we could add more for reviewers collaborative historic comments)

%FDF-1.4
%âãÏÓ

1 0 obj
<<
/FDF <</Annots [2 0 R]/F (Jupiter.pdf)/UF (Jupiter.pdf)>>/Type /Catalog
>>
endobj

2 0 obj
<<
/C [1 1 0]/Contents (Hello World!)/F 4/M (D:20230301)/NM (12345678-1234-1234-1234567890123456)
/Page 0/QuadPoints [36 792 180 792 36 756 180 756]/Rect [36 756 180 792]/Subtype /Highlight/Type /Annot
>>
endobj

trailer
<<
/Root 1 0 R
>>
%%EOF

You need both of /QuadPoints [36 792 180 792 36 756 180 756]/Rect [36 756 180 792] to define the workarea and /RECT coloured zone.

Note the points are easier when integers as default 1/72" but can be scaled imperial or metric real units ##.## depending on other transforms

enter image description here

So my quads example could be considered up-side down or Z order but works The Rect is easier to determine as LLx LLy URx URy based on a page Media Origin itself at Lower Left.

enter image description here

K J
  • 8,045
  • 3
  • 14
  • 36