Search code examples
htmldocxdocconverterscloudconvert

Error converting raw HTML input into a .doc file with cloudconvert


I have html text i want to convert into a doc file. I tried the CloudConvert API console ( https://cloudconvert.com/api/convert/html-to-doc ) to generate a request. In Code Snippets > HTML form this gives me the following form:

<form action="https://api.cloudconvert.com/convert" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="apikey" value="MyAPIKey">
    <input type="hidden" name="inputformat" value="html">
    <input type="hidden" name="outputformat" value="doc">
    <input type="hidden" name="input" value="raw">
    <input type="hidden" name="file" value="<p>test</p>">
    <input type="hidden" name="filename" value="test.doc">
    <input type="hidden" name="wait" value="true">
    <input type="hidden" name="download" value="true">
    <input type="submit" value="Convert!">
</form>

However this doesn't work and i constantly get the same error:

{"error":"The filename parameter should be the name of the input file, not of the output file!","code":400}

The error is misleading since there is no input "file" here; and a name for the output file IS required - if i leave the filename parameter out it also complains.

What am i doing wrong here, or are there any alternative services that could convert HTML into .doc or .docx formats?


Solution

  • Set filename to test.html (as the error message says, it should be the name of the input file).