-
Install HyPDF addon with your plan
$ heroku addons:add hypdf:giga
-
Add HyPDF credentials to your local .env file
$ heroku config -s | grep HYPDF_ >> .env
This file contains hidden or 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
# | |
# systemd unit file for CentOS 7, Ubuntu 15.04 | |
# | |
# Customize this file based on your bundler location, app directory, etc. | |
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu). | |
# Run: | |
# - systemctl enable hypdf | |
# - systemctl {start,stop,restart} hypdf | |
# | |
[Unit] |
This file contains hidden or 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
require 'hypdf' | |
require 'open-uri' | |
require 'base64' | |
# SVG file from wikipedia article | |
svg = open('http://upload.wikimedia.org/wikipedia/commons/1/12/%D0%9F%D1%80%D0%B8%D0%BC%D0%B5%D1%80_%D1%87%D0%B5%D1%80%D1%82%D0%B5%D0%B6%D0%B0_%D0%B2_SVG_%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B5.svg').read | |
# Embedding SVG to HTML via <img> tag | |
html = "<html><img src='data:image/svg+xml;base64,#{Base64.encode64(svg)}'></html>" |
This file contains hidden or 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
import requests # http://docs.python-requests.org/ | |
from flask import Flask # http://flask.pocoo.org/ | |
from flask import request | |
app = Flask(__name__) | |
# Make request to the HyPDF and upload the created file to the AWS S3 in an asynchronous style. | |
@app.route("/") | |
def index(): | |
params = {'user': 'HYPDF_USER', 'password': 'HYPDF_PASSWORD', 'test': 'true', 'content': '<html><body>Test</body</html>', 'bucket': 'hypdf_test', 'key': 'hypdf_test.pdf', 'public': 'true', 'callback': 'http://yoursite.com/pdf_complete'} | |
r = requests.post('https://www.hypdf.com/htmltopdf', data=params) |
This file contains hidden or 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
var FormData = require('form-data'), | |
fs = require("fs"); | |
var form = new FormData(); | |
form.append('user', 'HYPDF_USER'); | |
form.append('password', 'HYPDF_PASSWORD'); | |
form.append('test', 'true'); | |
form.append('bucket', 'hypdf_test'); | |
form.append('key', 'hypdf_test.pdf'); | |
form.append('public', 'true'); |
This file contains hidden or 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
Andale Mono | |
Arial Black | |
Arial | |
Century Schoolbook L | |
Comic Sans MS | |
Courier New | |
DejaVu Sans Mono | |
DejaVu Sans | |
DejaVu Serif | |
Dingbats |