Snip Snipping Tool Chrome Extension Convert API Secure Conversion Service
Make Documents Accessible Process Chemical Documents Collaborate on Documents Developer Solutions Train Language Models Support Academic Research Artificial Intelligence Fintech Edtech Pharma & Chemical Universities & Schools
Handwriting Recognition Digital Ink On-prem PDF Cloud Mathpix Markdown All Supported Languages Image Conversion PDF Conversion Markdown Conversion Table OCR Mathpix CLI PDF Search PDF Reader PDF Data Extraction Chrome Extension View Conversion Gallery
Snip Convert API SCS
Mobile Desktop Web Chrome Extension
Mathpix Snip Apps Convert API Mathpix Markdown Python SDK
About Blog Careers Contact
Get Started

How to use the Spectra CLI tool to process PDFs

Spectra is a command line interface tool that allows you to convert PDFs on your local machine to .docx, .tex, .html or .mmd (Mathpix Markdown) formats. This is an alternative to PDF conversion by making an HTTP request to our v3/pdf endpoint.

Spectra CLI Quickstart - Mac

Open your Terminal app.
Make sure you have NodeJS installed on your machine. If you don’t, here is a guide you can follow. Spectra requires at least Node v10.
Run this command in your terminal to install Spectra:
npm install -g @mathpix/spectra
Next, go to your Mathpix account and copy your API key.
Copy your API key
Use the key to set an environment variable for your API key by running this command:
export MATHPIX_OCR_API_KEY=your_api_key
Now you can convert PDFs to .mmd, .docx, .tex, and .html formats with this command:
spectra convert input-file.pdf output-file.mmd
Make sure specify the desired file type for the output format in the command, here I’ve chosen .mmd.
Convert a pdf to mmd
In this example, I converted one of Andrew Ng’s CS 229 Lecture Notes PDFs. Here is the result as a .mmd file rendered in VS Code:
Convert a pdf to mmd result

Spectra CLI Quickstart - Windows

Spectra CLI Quickstart - Linux