Rudy B
Rudy B

Reputation: 68

Error when sending DOCX to DocuSign REST API

I'm getting the following error when trying to send DOCX documents to docusign through the rest API Until now it has worked just fine for almost a year. I've tested it with a variety of DOCX files and all of them return this error

"errorCode": "UNABLE_TO_CONVERT_DOCUMENT", 
"message": "System was unable to convert this document to a PDF. Unable to convert Document(afasf.docx) to a PDF. 
Error: UserId:********-****-*****-*****-*********** IPAddress:***.***.***.*** 
Source:ApiRESTv2:Could not submit Document to Conversion Server: EnvelopeId:00000000-0000-0000-0000-000000000000 DocumentName:afasf.docx - 
SubmitCode: -10242\r\nCould not submit Document to Conversion Server: EnvelopeId:00000000-0000-0000-0000-000000000000 DocumentName:afasf.docx - 
SubmitCode: -10242\r\nCould not submit Document to Conversion Server: EnvelopeId:00000000-0000-0000-0000-000000000000 DocumentName:afasf.docx - 
SubmitCode: -10242\r\n"

Upvotes: 0

Views: 1358

Answers (2)

Ben Rolfe
Ben Rolfe

Reputation: 469

Have you tried setting the file extension?

var doc = new docusign.Document();
var base64Doc = Buffer.from(fileBytes).toString('base64');
doc.documentBase64 = base64Doc;
doc.fileExtension = 'docx';

Upvotes: 1

David W Grigsby
David W Grigsby

Reputation: 1574

I look forward to your answers from above, but here is working example in base64 of a docx

I use this online tool for encoding, decoding files to/from base64 http://www.opinionatedgeek.com/dotnet/tools/Base64Encode/

URI, Verb and Headers:

POST /restapi/v2/accounts/225705/envelopes HTTP/1.1
Host: demo.docusign.net
X-DocuSign-Authentication: your info aka userid, password and integrator key
Content-Type: multipart/form-data; boundary=AAA
Accept: application/json

Body of Post:

--AAA
Content-Type: application/json
Content-Disposition: form-data

{
    "emailBlurb": "Test for basic docx",
    "emailSubject": "Test for docx",
    "status": "sent",
    "compositeTemplates": [
        {
            "inlineTemplates": [
                {

                    "sequence": "1",
                    "documents": [
                        {
                            "documentId": "1",
                            "name": "basic.docx"
                        }
                    ],
                    "recipients": {
                        "signers": [
                            {
                                "recipientId": "1",
                                "name": "Your Name",
                                "email": "[email protected]",
                                "defaultRecipient": "true",
                                "tabs": {
                                    "signHereTabs": [{
                                    "anchorString": "\\Signhere\\",
                                    "tabLabel": "Sign Here 1"
                                    }]
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

--AAA
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: file; filename="basic.docx"; documentid=1
Content-Transfer-Encoding: base64

UEsDBBQABgAIAAAAIQDpURCwjQEAAMIFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAAC **[base64 truncated to meet StackOverflow Limit of 30000 since it was 33196 ]** FYAAGRvY1Byb3BzL2FwcC54bWxQSwUGAAAAAA0ADQBOAwAAtVgAAAAA

--AAA--

Upvotes: 8

Related Questions