Endpoint /documentprocessing/pdf/create

POST https://example.com/documentprocessing/pdf/create

POST

Creates a PDF document from an input document.

Examples

The following example creates a new PDF document from a document in the internal format.

# Request:
curl --location --request POST 'https://trial.dsserver.io/documentprocessing/pdf/create?returnFormat=PDF' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer fePFHv8OtIyRSCAdOnn7USc9kKdYB2rg' \
    --data-raw '{
        "DocumentData": "eAUBAA4AAAAAAAAAAA[..]="
    }'

# Result:
"JVBERi0xLjQNJ[..]"

Authorization

This endpoint supports the OAuth authorization method:

OAuth

DS Server implements OAuth as the authorization method. Two flows are supported:

  • Authorization Code
  • Client Credentials

In order to use the Client Credentials flow, this method must be explicitly enabled in the admin portal of DS Server.

In both cases, a valid access token returned from the OAuth endpoints must be passed in a Bearer Authorization Header or as a Query Parameter.

Authorization Header

Header Field Description
Authorization

A Bearer authorization header (also called token authentication) contains the OAuth access token. The authorization method and a space i.e. "Bearer " is then put before your valid access token. For example:

Authorization: Bearer 4796E23054E64BC773CACBCAF24AD179DE9A3

Query Parameter

Query Parameter Description
access_token

The access token is passed directly in the endpoint URL as a query string. For example:

?access_token=4796E23054E64BC773CACBCAF24AD179DE9A3

Request Parameters

Name Type Value Optional
returnFormat String A string that specifies the format of the created document. Possible values are: "PDF", "PDFA". Default value is "PDF". yes

Request Payload

Type Value
PDFCreationSettings The PDFCreationSettings object contains the settings for the requested PDF document.

PDFCreationSettings

Name Type Value Optional
documentKeywords String[] String array that contains keywords that will be added to the PDF document meta information. yes
documentLevelJavaScriptActions String[] String array that contains JavaScript actions that are embedded in the PDF. yes
imageCompressionQuality int Specifies the compression quality of images between 1-100. yes
masterPassword String Specified the master password. yes
digitalSignature DigitalSignature Specified the digital signature that will be used to sign the document. yes
embeddedFile EmbeddedFile Specifies an array of embedded files that are embedded into the document. yes
documentAccessPermissions DocumentAccessPermissions Specifies access permissions for the document. yes
documentData String Document that will be converted to PDF encoded as Base64 string. no
author String Sets the document's author. yes
creationDate DateTime (String) Sets the document's creation date which will be saved in the document. yes
lastModificationDate DateTime (String) Sets the date the document is last modified. yes
creatorApplication String Sets the application, which has created the document. yes
documentSubject String Sets the document's subject string which will be saved in the document. PDF limitation: The length is limited to 2000 characters. yes
documentTitle String Sets the document's title that will be saved in the document. PDF limitation: The length is limited to 2000 characters. yes
userPassword String Specifies the password for the user to open the document. yes
culture String Specifies the culture for the merge process for date and currency values. It must be the Language Culture Name that can be found in this list. For French use "fr-FR", for German "de-DE". Default value is "en-US". yes

DigitalSignature

Name Type Value Optional
x509Certificate2 String The actual certificate in a X509 format. no
password String The password for the given certificate. no
timeServerURL String An URL for a time server. yes

EmbeddedFile

Name Type Value Optional
creationDate Long Specifies the date of the creation (UNIX EPOCH time). yes
data String Specifies the data of the embedded file. yes
dataType String Specifies the type of the data. yes
description String Specifies the description of the embedded file. yes
fileName String Specifies the file name of the embedded file. yes
lastModificationDate Long Specifies the last modification date (UNIX EPOCH time). yes
MIMEType String Specifies the MIME type of the embedded file (for example: "application/pdf"). yes
relationship String Specifies the relationship string of the embedded file. yes
metadata String Specifies meta data for the embedded file. yes

DocumentAccessPermissions

Name Type Value Optional
None = 0 Enum Allows none of the possible permissions. yes
AllowAuthoring = 1 Enum Allows authoring comments and fill in interactive form fields (including signature fields). yes
AllowAuthoringFields = 2 Enum Fill-in existing interactive form fields (including signature fields) is allowed. yes
AllowContentAccessibility = 4 Enum Allows content access for the visually impaired only. yes
AllowDocumentAssembly = 8 Enum Allows to assemble the document (insert, rotate or delete pages and create bookmarks or thumbnails). yes
AllowExtractContents = 16 Enum Copying or otherwise extracting text and/or graphics is allowed. yes
AllowGeneralEditing = 32 Enum Allows modifying the document's contents. yes
AllowHighLevelPrinting = 64 Enum Printing the document is fully allowed. yes
AllowLowLevelPrinting = 128 Enum Printing the document is allowed (low-level). yes
AllowAll = 255 Enum Allows all of the possible permissions. yes

Success Response

Status Description
200 On success, the HTTP status code in the response header is 200 (OK). The response body contains the resulting document encoded as a Base64 encoded string.

Error Response

Status Description
401 A 401 (Unauthorized) is returned, if the user is not authorized.
400 A 400 (Bad Request) is returned, if DS Server is not licensed or the license is invalid.
400 A 400 (Bad Request) is returned, if no data is found in the PDFCreationSettings object.
400 A 400 (Bad Request) is returned, if no documents were found in the PDFCreationSettings object.
400 A 400 (Bad Request) is returned, if the uploaded document is not valid.