!git clone https://bitbucket.org/luisfernando/html2pdf.git

%%!
echo "Install Xvfd:"
sudo apt-get install xvfb

echo "Install Fonts:"
sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

echo "Install wkhtmltopdf:"
sudo apt-get install wkhtmltopdf

"""
Explanation: HTML转为PDF格式。
https://pypi.python.org/pypi/html2pdf/0.1
wkhtmltopdf (Linux)
End of explanation
"""


%%!
source activate GISpark
pip install html2pdf

"""
Explanation: python-wkhtmltopdf (Any Platform)
Development:
$ git clone https://bitbucket.org/luisfernando/html2pdf.git
$ cd html2pdf
$ virtualenv .
$ pip install -r requirements.pip

PIP:
$ pip install git+https://bitbucket.org/luisfernando/html2pdf.git

or from pypi
$ pip install html2pdf
End of explanation
"""


from wkhtmltopdf import HTMLURLToPDF

make_pdf = HTMLURLToPDF(
    url='http://www.example.com',
    output_file='~/example.pdf',
)

make_pdf.render()

"""
Explanation: Render a URL:
End of explanation
"""


from html2pdf import HTMLToPDF

HTML = """
    <!DOCTYPE html>
    <html>
        <body>
        <h1>Hello World</h1>
        </body>
    </html>
"""

h = HTMLToPDF(HTML, self.output_file)

!wkhtmltopdf

"""
Explanation: Render a HTML string:
End of explanation
"""


