Convert Documents With Text
Purpose
To convert a document's existing file format (say DOCX) to any other file format (say HTML or TXT) with text parameter.
Quick Reference
| Property | Value |
|---|---|
| Method | POST |
| Request URL | https://{zohoapis_domain}/writer/api/v1/documents/convert |
| Scopes | ZohoWriter.documentEditor.ALL |
| Rate Limit | See Writer API throttle limits |
Parameters
Body Parameters
| Parameter | Data Type | Mandatory/Optional | Description |
|---|---|---|---|
| format | String | Mandatory | Specify the format in which the converted document needs to be downloaded. Supported file formats: docx, odt, rtf, txt, html and pdf |
| text | String | Mandatory | Provide the required text that needs to be converted. |
| filename | String | Mandatory | Specify a name to the converted document. |
Notes
- Note: PDF to Docx conversion is not supported in Writer yet.
- For possible errors, refer to error codes.
Curl Snippet
Copiedcurl --location --request POST "https://www.zohoapis.com/writer/api/v1/documents/convert" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form "text=Sample content for conversion" \
--form "format=docx" \
--form "filename=Sample File"Deluge Snippet
Copiedhtml_text = '<body><p>Hello</p><p>How are you? <b>My friend!</b><br></p><div style="width: 50px"><img src="https://www.epromsa.com/img/epromsa-logo-1435568219.jpg" width="168" height="50" /></div><br>Regards from <b>TicServei</b></body>';
html_file = html_text.toFile("Converted_doc");
partList = list();
partList.add({"paramName":"content","content":html_file});
partList.add({"paramName":"format","content":"pdf","stringPart":"true"}); //output format
partList.add({"paramName":"filename","content":"Converted_doc","stringPart":"true"});
My_PDF = invokeurl
[
url :"https://writer.zoho.com/api/v1/documents/convert"
type :POST
files:partList
connection:"<connection_name>"
];