Let us convert your documents for you with the Web REST API version of Word Cleaner…
Word Cleaner is the best solution for bulk converting Word files and other document formats to clean HTML. Convert all your Word files (as well as other text formats & PDF) to HTML (or txt, CSV & epub). Best of all our powerful customizable templates give you full control over your conversions. Control the CSS, images, split pages, find and replace/delete code and much more.
How to call our API to convert documents to HTML from within your own application
Before you begin you need to have an account with our Word Cleaner Online Web App. If you have not done so please register for an account now. You can test the service for free but for production use you will need to sign up for one of our paid plans.
Currently the Word Cleaner Web Rest API exposes the following API method:
https://api.wordcleaner.com:8080/api/converter/convertdoc – this API method will convert files sent via POST and will return or post back to a given URL the converted zip or HTML file.
The input parameters are:
- template – optionally specify a template name parameter, for instance: ‘Convert to HTML5’ . This template is used by default if a parameter is not specified. The template name has to be exactly as on Word Cleaner Online templates list, note you can create your own custom templates.
- returnHtml – option to return either a zip file (set it to false) with all the conversion files in it or a single HTML file (set it to true). By default it’s set to ‘false’ – return a zip file. To return only a HTML file set this option to ‘true’. Please note that if you set it to true then only the HTML file is returned, other files like images or CSS files are not sent. Only the zip file option contains all the converted files.
- returnData – option to return raw octet-stream data, default is ‘false’ and it returns URL to converted file on the Word Cleaner Web API server
- backUrl – if specified WC API method will convert input files and will send them in zip or HTML file back via POST to that specified URL.
Please note that you need a website or server to process these post request, please check out the ReceivePostFile.zip sample ASP.NET app that receives files sent via POST from that API method.
The Web API uses the same template files that you have in your Word Cleaner Online account; therefore, you can use the Word Cleaner Online version to prepare your template and perform any testing.
Questions? Contact us anytime.
Check out our web example page…
We have created a sample page that demonstrates how the API conversion works: PostConvertReturn.html
How to use the sample page:
- enter your login credentials, the same login as your Word Cleaner Online account and click the Log In button. If you don’t have a Word Cleaner Online account yet please Register for free.
- select the input document files that you want to convert
- optionally enter a template name
- optionally choose if you want to return a zip file with all output conversion files or just get the html file back
- optionally choose if you want to return raw data or URL string to that data file located on WC server, using this raw data option with return html option is useful if you want to use only converted html right away after the server response
- also you can enable sending file back to given URL via POST, please specify your own working Post back URL
Please view the HTML and PostJsCode.js file source code of that page to see how you can use this API method.
Example .NET Winforms C# app…
Please check out WebAPITestApp.zip sample .NET Winforms C# app that does the same as PostConvertReturn.html sample page. Based on that sample app C# code you can write code for ASP .NET MVC web applications as well.
Example PHP code …
Please check out WebAPIPhpSample.zip sample PHP/HTML code that demos how to get API token and convert uploaded file. Extract zip to a php web server. Edit convert.php file and enter your Word Cleaner Online email and password on line 28. Set write permissions on upload/ folder if needed. Go to index.php in a browser, then select document to convert and click Start Converting button.
Example Java code …
Please check out WebAPIJavaSample.zip sample Java code that demos how to get API token and convert uploaded file. Extract zip and edit WordCleanerWebApi.java file and enter your Word Cleaner Online email and password in GetAccessToken() method. Enter your doc file name and path and run.