WARNING: This is a beta client and subject to serious change
gem install docraptor-cli
docraptor local_file.html # local files docraptor https://docraptor.com/examples/invoice.html # URLs are detected by prefix
The full DocRaptor API is available, see:
We have guides for doing some of the common things:
- Headers and Footers including page skipping
- CSS Media Selector to make the page look exactly as it does in your browser
- Protect content with HTTP authentication or proxies so only DocRaptor can access them
--callback-url option can be used to set a URL that will receive a POST request after your document has successfully been processed. You can simulate this in your *nix development environment using a couple of simple tools:
Let's say you had some document content in a file named
test.html. To test the callback URL, start a new console and type:
nc -lk 9001
This will listen on port
9001 for requests. Now open another console and type in:
ngrok http 9001
This will setup an external URL that port forwards to port
9001 on your computer (conveniently being listened to by
nc). Note the ngrok http URL. It should look something like
http://87654321.ngrok.io. Copy that URL and open a third console where we will generate our document:
bin/docraptor test.html --async --callback_url "http://87654321.ngrok.io"
After the document has been generated, if we go to our console running
nc, we should see we got an HTTP POST request that looks something like this:
POST / HTTP/1.1 Connection: close Host: d94c779c.ngrok.io Content-Length: 139 Content-Type: application/x-www-form-urlencoded X-Forwarded-For: 22.214.171.124 download_url=https%3A%2F%2Fdocraptor.com%2Fdownload%2Fe4eabaca-f811-49f8-9375-fcb9cdeae5aa&download_id=e4eabaca-f811-49f8-9375-fcb9cdeae5aa
Stuck? We're experts at using DocRaptor so please email us if you run into trouble.
This code is a thin wrapper around the docraptor gem to make it suitable for command line users.
- Pull latest master
- Merge feature branch(es) into master
- Increment version in code:
- Update CHANGELOG.md
- Commit "Release vX.Y.Z"
This library follows Semantic Versioning 2.0.0.