This Web service is used to execute the APE's Transform step.
Input message format
The JSON input message format is as follows:
{
"xslfoDoc": "string",
"outputMimeType": "string",
"options": {
"docDescription": {
"author": "string",
"creationDate": "2018-12-03T15:06:09.729Z",
"creator": "string",
"keywords": "string",
"producer": "string",
"subject": "string",
"title": "string"
},
"pdfDocPolicy": {
"allowAccessContent": "string",
"allowAssembleDocument": "string",
"allowCopyContent": "string",
"allowEditAnnotations": "string",
"allowEditContent": "string",
"allowFillInForms": "string",
"allowPrint": "string",
"allowPrintHq": "string",
"encryptMetadata": "string",
"ownerPassword": "string",
"userPassword": "string"
}
}
}
When the Web service runs without error, the returned HTTP code is 200 and the response is a document in the requested output format.
If there is an error, the returned HTTP code is either 400 if the query body is incorrect, or 500 when an error occurs during template processing. If there is an error, the returned response is JSON type. ↑ Top of page
Attributes
The message must represent a JSON object with the following attributes:
xslfoDoc
This attribute is mandatory and String type. It represents the content of a final XSL-FO document. See "XSL-FO language" section in "Apache FOP".
outputMimeType
This attribute is mandatory and String type. It represents the MIME type corresponding to the output format of the result document to produce. See "Output formats" section in "Apache FOP".
options
This attribute is optional and Object type. It represents the additional parameters to take into account when transforming the XSL-FO document. All the options are described in a JSON object, each member of which describes an option, i.e.
- docDescription: option to define metadata stored in the result document (JSON Object-type value). This option can only be used with certain output formats which authorize metadata storage. The Apache FOP engine currently only implements metadata support for the "application/pdf " format.
- pdfDocPolicy: option to define the document permissions policy in "application/pdf" format (JSON array of Object-type value). This groups the protection functions by password, print authorizations, etc.
Document metadata
The "docDescription" attribute groups a set of metadata to set for a document in a JSON object.
Each item of metadata (optional) is stored in an attribute, namely:
- "author" (alphanumeric string): description of the document author,
- "creationDate" (alphanumeric string in ISO 8601 format corresponding to a timestamp): document creation date and time (replaces the date at which the document was created),
- "creator" (alphanumeric string): description of the document creator (default value: "Apache FOP Version 2.2 "),
- "keywords" (alphanumeric string): keywords associated with the document,
- "producer" (alphanumeric string): description of the system (or application) that produced the document (default value: "Apache FOP Version 2.2 "),
- "subject" (alphanumeric string): document subject,
- "title" (alphanumeric string): document title.
Document permissions policy
For a document in PDF format, the "pdfDocPolicy" attribute groups a set of permissions applicable to manipulating the document in a JSON object. Each permission (optional) is stored in an attribute, namely:
- "userPassword" (non-empty alphanumeric string): password to open the document. When a document is used by a document reader (Acrobat Reader for example), this password will be required in order to view the content. A PDF document cannot be opened without the "userPassword" whichever PDF reader is used (Acrobat Reader, Foxit Reader, etc.),
- "ownerPassword" (non-empty alphanumeric string): password to access the document's permissions. It controls the permissions such as printing, editing, extraction, comments, etc. The reader prohibits these operations according to the permission settings. This will ask you for your password if you wish to define or change the permissions for this document,
- "allowPrint" ("true" or "false" alphanumeric string): indicates permission to print the PDF document using a reader (allowed by default),
- "allowPrintHq" ("true" or "false" alphanumeric string): indicates permission to print the PDF document in high resolution using a reader (allowed by default),
- "allowCopyContent" ("true" or "false" alphanumeric string): indicates permission to copy the document content to the clipboard using a reader (allowed by default),
- "allowEditContent" ("true" or "false" alphanumeric string): indicates permission to edit the document content using a reader (allowed by default),
- "allowAccessContent" ("true" or "false" alphanumeric string): indicates permission to extract text and images from the document using a reader (not allowed by default),
- "allowAssembleDocument" ("true" or "false" alphanumeric string): indicates permission to assemble the pages of the document using a reader (not allowed by default),
- "allowFillInForms" ("true" or "false" alphanumeric string): indicates permission to fill in the document's form fields using a reader (allowed by default),
- "allowEditAnnotations" ("true" or "false" alphanumeric string): indicates permission to edit the document's annotations (comments) using a reader (allowed by default),
- "encryptMetadata" ("true" or "false" alphanumeric string): indicates whether metadata has to be encrypted (true by default).
Headers
Some headers can be added in the HTTP request which triggers this web service. These headers are treated as additional input or input-output parameters:
Name | Type | Description |
---|---|---|
Ape-Total-Number-Pages | Input-Output | When the request contains this parameter, it is returned in the response with the total number of pages of the produced document as a value. |