Skip to content

Convert API

The Convert API from Signdoc is used to convert a PDF document to a format that is compatible with BankID signing and the Signdoc API.

API

Get the list of supported conversion formats

Request

GET [signdoc-baseurl]/signdoc/convert/pdf/specs
Headers
Content-Type: application/json

Response

List of currently supported PDF conversions.

{
    "pdfSpecs": [
        "PDFA_2B"
    ]
}

Convert a PDF document

Request

POST [signdoc-baseurl]/signdoc/convert/pdf
Headers
    Authorization: Bearer [access_token]
    Content-Type: application/json
Body

JSON array of documents to be signed (minimum one).

The pdf field contains the PDF document to be converted Base64 encoded.

{
  "documents": [
    {
      "pdf": "JVBER...",
      "pdfSpec": "PDFA_2B"
    }
  ]
}

Response

Results of the conversion, including any warnings or errors.

conversionWarnings contains an array of warnings that occurred during the conversion.

Possible values are:

VISUAL_DIFF("Visual differences in output PDF")
COLORANTS("Resolve name collisions of colorants")
OCG_REMOVED("Removed optional content groups (layers)")
TRANSP_REMOVED("Transparency removed")
XMP_REMOVED("Removed non convertible XMP metadata")
FONT_SUBST("Font substituted")
ACTION_REMOVED( "Removed interactive elements such as actions or annotations")
STRUCTURE_REMOVED("Structure removed")

Documents that could not be converted will have a list of errors in conversionErrors:

CORRUPT("Document is corrupt")
DOC_SIGNED("Document contains signatures")
EF_REMOVED("Embedded files removed")
GENERIC_ERROR("Unknown error")
DISABLED("PDF conversion is disabled")

Note

In CURRENT the response will always be DISABLED("PDF conversion is disabled") and "converted" = false

{
    "conversionResults": [
        {
            "conversionId": "d886b218-af9f-4765-a9e1-d819fec6abbe",
            "description": "My order name - 1",
            "converted": true,
            "conversionErrors": [],
            "conversionWarnings": [
                "Visual differences in output PDF",
                "Removed interactive elements such as actions or annotations"
            ],
            "convertedDocument": "JVBERi0xLjcKJ"
        },
        {
            "conversionId": "1b4c673a-9d9e-4680-8aa2-810a31d50d8c",
            "description": "My order name - 2",
            "converted": true,
            "conversionErrors": [],
            "conversionWarnings": [
                "Visual differences in output PDF",
                "Removed interactive elements such as actions or annotations"
            ],
            "convertedDocument": "JVBERi0xLjcKJ"
        }
    ]
}