Introducing the DocumentAlchemy CLI

the DocumentAlchemy blog

 
Introducing the DocumentAlchemy CLI

The DocumentAlchemy team is happy to announce the release of a command-line interface to our document processing API.

The command line interface makes it even easier to use the DocumentAlchemy API, whether for quick, one-off conversions or as a simple tool for integrating DocumentAlchemy with other programs.

The DocumentAlchemy CLI installs a program called document-alchemy with which you can invoke DocumentAlchemy's API endpoints thru a simple command-line syntax.

For example, to convert an MS Word document to Markdown, you can use:

document-alchemy convert WORD_DOC.docx --to md

The same general form works for most document-to-document conversions:

document-alchemy convert MARKDOWN.md --to docx > Word-from-Markdown.docx

document-alchemy convert DOCUMENT.pdf --to txt > Text-from-PDF.txt

document-alchemy convert SLIDE-DECK.pptx --to images.zip > Images-extracted-from-PowerPoint.zip

document-alchemy convert CHARTS.xls --to pdf > PDF-from-Excel.pdf`

(and so on.)

In addition to convert as of this writing the application currently supports qrcode for generating QR codes:

document-alchemy qrcode "Hello World!" -o hello.png

and capture for generating “sceenshots” of web pages:

document-alchemy capture https://google.com/ -w 1024 -h 600 -o screenshot.png

Best of all, the DocumentAlchemy command-line tool is extendable, expandable and open source.

The document-alchemy-cli application is architected to support “pluggable” commands. Any JavaScript component that implements a simple interface can be added to the document-alchemy app as a “sub-command”. For this reason, (1) we expect it won't be long to add support for additional REST endpoints to the command-line app, and (2) you can easily add custom sub-commands that are purpose-built to your workflow.

You can find the source code for the DocumentAlchemy command-line tool at GitHub at https://github.com/documentalchemy/document-alchemy-cli.

Installing and using the Document Alchemy command-line tool

The document-alchemy client is currently packaged as a server-side JavaScript (Node.js) module. Hence to install it you'll first need to install Node.js by following the directions at https://nodejs.org/.

With Node.js (v0.10+) installed, to install the document-alchemy app, just enter:

npm install document-alchemy-cli -g

You can then use the in-app help feature for up-to-date documentation on how to use the tool. Just enter:

document-alchemy --help

for help on using the program in general, or:

document-alchemy --xhelp

for detailed (eXtended) help on using the program in general, or:

document-alchemy <COMMAND> --help
document-alchemy <COMMAND> --xhelp

for short or long help (respectively) on a specific sub-command.

Additional help can be found in the GitHub repository and related pages.

* * * * *

The document-alchemy-cli module is open-source for a reason We hope you'll find it useful and instructive, and invite you to adapt it to your needs. (Since the application is “MIT”-licensed, you are free to use and even modify the app for proprietary commercial applications.)

We welcome and appreciate any feedback, questions, comments, bug-reports or pull requests you'd like to share with us.

About DocumentAlchemy

DocumentAlchemy is a RESTful web service that developers can use to add document generation, conversion and processing features to their app.

Visit our live demonstrations or interactive API reference to explore Document Alchemy's rapidly growing API for working with MS Office documents, PDFs, images, web pages and more.


Copyright © 2017 DocumentAlchemy.