Skip to content

Instantly share code, notes, and snippets.

@DocumentAlchemy
Last active April 18, 2016 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DocumentAlchemy/e799beb4d80f7caa9a81a13587a5453e to your computer and use it in GitHub Desktop.
Save DocumentAlchemy/e799beb4d80f7caa9a81a13587a5453e to your computer and use it in GitHub Desktop.
Example of using curl and DocumentAlchemy to render a Markdown file as a PDF document via the command line.
# Example of using curl and the DocumentAlchemy API to render a
# Markdown document as a PDF.
# There are several parameters that can be used to control the
# structure and format of the generated PDF document that are
# not included in this simple example. See the DocumentAlchemy
# API documentation at <https://documentalchemy.com/api-doc> for
# more information about these options.
#
# See <https://documentalchemy.com/> for more information about
# DocumentAlchemy's document conversion and processing capabilities.
# Assuming:
#
# - `403l1zh3dkbakyb9` is the value of your Document Alchemy API key,
# - `MY_DOCUMENT.md` is the file you want to convert
# - `MY_DOCUMENT.pdf` is the file you want to save the converted document to
#
# the following command will generate a PDF document from a Markdown file:
curl -H "Authorization: da.key=403l1zh3dkbakyb9" \
-X POST --form "document=@MY_DOCUMENT.md" \
https://documentalchemy.com/api/v1/document/-/rendition/pdf \
-o "MY_DOCUMENT.pdf"
#
# Change `pdf` to `html` to render the Markdown file as an HTML document.
#
# Change `pdf` to `docx` to render the Markdown file as an MS Word document.
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment