POST

/docx/html

This endpoint is used to convert a valid Docx or Doc file (such as a Microsoft Word, or Open Office document) to an HTML file. If images are included in the word file those will be converted to embedded images inline with the HTML. It allows full configuration options described in the table below to be passed into the multi-part form body.

ParamDescription
url
(string)

Source URL to use for generating the PDF

Required if no file
file
(file)

The input file for the multipart/form-data as part of the POST request.

Required if no url
timeout
(number)

Amount of time that Chrome is allowed to run, if exceeded your job will be terminated and you will not be charged.

Default: 30000 ms (30 seconds)
delay
(number)

The amount of time in milliseconds to wait for the page to complete rendering before conversion.

Default: 0
filename
(string)

If used with the inline:false, will set the Content-Disposition filename so that the downloaded file will be set to this value in the users browser. For inline:true it has no effect.

Default: 'file.pdf'
inline
(boolean)

If set to true, set's the Content-Disposition to 'inline', if set to false it will set the Content-Disposition to 'attachment'. See 'filename' property if you want to set the filename value for the attachment.

Default: false
    {
  "url": "",
  "file": "",
  "timeout": 30000,
  "delay": 0,
  "filename": "file.pdf",
  "inline": false
}
Copied!
Example
    curl --request POST \
--url https://api.cloudlayer.io/v1/docx/html \
--header 'content-type: multipart/form-data' \
--header 'x-api-key: <api key>' \
--form [email protected] \
--form timeout=10000 \
--output test.html
Copied!
Input
Result

This conversion can handle most word documents that do not have a complex layout. Converting a word type document to HTML does not always produce a perfect replica of the original source. There are significant differences in how Word documents treat layout compared to HTML. You will need to test out your results, and see if they are acceptible for your scenario. Converting to a PDF document will yield a significantly better result in most cases and is preferred over the HTML conversion if possible.