DynaPDF Manual - Page 54

Previous Page 53   Index   Next Page 55

Interactive Forms
Page 54 of 839
JSON Parser
Since version 4.0.74.216, DynaPDF contains a JSON parser (Javascript Object Notation) that
simplifies the exchange of complex data structures a lot.
The JSON parser supports a few extensions to make the definition of additional attributes as
easy as possible.
Differences in comparison to regular JSON grammar:
A JSON string begins normally with a left brace ({) and ends with a right brace (}). This
outer left / right brace pair can be omitted.
Name or key / value pairs must normally be delimited by a colon (:). The delimiting
colon can be omitted.
Array values must normally be delimited by a comma (,). The delimiting comma can be
omitted if the bounds of a value can be detected by whitespace or starting character of
an object.
Example (C/C++):
const char attr[] = "\"TestArray\"[1/2\"3\"4 5]";
Result:
/TestArray[1/2(3)4 5]
That means the first value of the array is the number 1, the second is a name object with
the value "2", the third value is the string "3", the fourth is the number 4, and the fifths is
the number 5.
Extension: A Solidus (/) begins a PDF Name object. The solidus is not part of the name
but is a prefix indicating what follows is a sequence of characters representing a name
object. A name object supports character codes between 33..126 inclusive. Any character
outside this range must be written as two digit hexadecimal code, preceded by a number
sign (#), e.g. /This#20is#20a#20name#20with#20spaces. Note that a number sign in a
name object must be written as hexadecimal code too, since the number sign is treated as
an escape character. The de-escaped string is interpreted as UTF-8 Unicode string.
A name object is terminated by character codes < 33, { (left brace), } (right brace), [ (left
bracket), ] (right bracket), , (comma), : (colon), and " (double quotes). If one of these
characters should be part of a name object then write it as two digit hexadecimal code
preceded by a number sign (#).
No predefined attribute key or value is defined in PDF that would require an escaping
mechanism.
 

Previous topic: Font embedding, Complex text layout and form fields

Next topic: Interactive Forms, Field Appearance