Last active
April 17, 2016 21:42
-
-
Save DocumentAlchemy/6abf48a428dd52c6a9cc9f06eea6a31c to your computer and use it in GitHub Desktop.
Example of using curl and the DocumentAlchemy API to convert a Word *.doc file to a post-Office 2007 *.docx file. (See <https://documentalchemy.com/> for more information.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of using curl and the DocumentAlchemy API to convert a | |
# Word *.doc file to a post-Office 2007 *.docx file. | |
# (See <https://documentalchemy.com/> for more information.) | |
# Assuming: | |
# | |
# - `403l1zh3dkbakyb9` is the value of your Document Alchemy API key, | |
# - `MY_DOCUMENT.doc` is the file you want to convert | |
# - `MY_DOCUMENT.docx` is the file you want to save the converted document to | |
# | |
# the following curl command will convert a (pre-Office 2007) *.doc Word document | |
# into a (post-Office 2007) *.docx Word document. | |
curl -H "Authorization: da.key=403l1zh3dkbakyb9" \ | |
-X POST --form "document=@MY_DOCUMENT.doc" \ | |
https://documentalchemy.com/api/v1/document/-/rendition/docx \ | |
-o "MY_DOCUMENT.docx" | |
# The same general format will work for Excel and PowerPoint files, just | |
# change all occurrences of `.doc` with `.xsl` or `.ppt` and all occurrences | |
# of `.docx` with `.xlsx` or `.pptx`. (Especially at the end of the URL | |
# in line 16). | |
# | |
# In fact, the same general format will also allow you to convert your | |
# Word document to PDF, Markdown, an image, etc. Just change the | |
# `docx` value in line 16 to your target format (`pdf` `md`, `png`, etc.) | |
# See <https://documentalchemy.com/api-doc#!/DocumentAlchemy> for detailed | |
# information on the underlying REST API methods. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment