Doc Converter Pro Web Rest API
How to call our API to convert documents from within your own application
Before you begin you need to have an account with our Doc Converter Pro 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 you will need to sign up for one of our paid plans.
Currently the Doc Converter Pro Web Rest API exposes the following API method:
https://api.docconverter.pro/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 Doc Converter Pro Online templates list, note you can create your own custom templates.
returnJson - option to return json with list of converted output file URLs (attention: do not set returnHtml or returnData options if you use returnJson)
returnHtml - option to return either a zip file (set it to false) with all the conversion files in it or a single output 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 Doc Converter Pro 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 ReceivePostFile.zip
sample ASP.NET app that receives file sent via POST from that API method.
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 Doc Converter Pro Online account and click the Log In button.
If you don't have a Doc Converter Pro Online account yet please Register for free.
select the input document file 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 Doc Converter Pro 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 Doc Converter Pro Online email and password in GetAccessToken() method. Enter your doc file name and path and run.
Example Ruby code ...
Please check out WebAPIRubySample.zip sample Ruby code that demos how to get API token and convert sample doc file.
Extract zip and edit dcp_web_api_sample.rb file and enter your Doc Converter Pro Online email and password on line 6 that gets api token.
Make sure to install multipart-post gem: gem install multipart-post and then run this sample with: ruby dcp_web_api_sample.rb
The Web API uses the same template files that you got on your Doc Converter Pro Online account; therefore, you can use the Doc Converter Pro Online version to prepare your template and preform any testing.
Questions? Contact us anytime.