wkhtmltopdf-wrapper
===================
A simple and direct python wrapper for the `wkhtmltopdf
lib <https://github.com/wkhtmltopdf/wkhtmltopdf>`__ inspired by inspired
by `Qoda's
python-wkhtmltopdf <https://github.com/qoda/python-wkhtmltopdf>`__
Requirements
------------
System:
~~~~~~~
- Linux 32/64 or OSX only (Windows is not supported at this stage)
- wkhtmltopdf
- python 2.5+ / python3
Installation
------------
wkhtmltopdf (Linux)
~~~~~~~~~~~~~~~~~~~
1. Install Fonts:
.. code:: bash
$ sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
2. Install wkhtmltopdf
goto http://wkhtmltopdf.org/downloads.html for the latest release
(Recommended)
wkhtmltopdf (OSX)
~~~~~~~~~~~~~~~~~
or goto http://wkhtmltopdf.org/downloads.html for the latest release
(Recommended)
wkhtmltopdf-wrapper (Any Platform)
----------------------------------
1. PIP:
.. code:: bash
$ pip install wkhtmltopdf-wrapper
or
.. code:: bash
$ pip install git+https://github.com/aguegu/wkhtmltopdf-wrapper.git
2. Development:
.. code:: bash
$ git clone https://github.com/aguegu/wkhtmltopdf-wrapper.git
$ cd wkhtmltopdf-wrapper
$ virtualenv .
$ pip install -r requirements.pip
Usage
=====
the option\_string would be sent to the wkhtmltopdf command line in
exactly the same shape. so the options can be anything as long as the
wkhtmltopdf supports. check its
`usage <http://wkhtmltopdf.org/usage/wkhtmltopdf.txt>`__. This lib is
just as simple as that. If anything goes wrong, just check the doc. If
the command execute ok with wkhtmltopdf dircetly, this wrapper should
work too.
As I check
`qoda/python-wkhtmltopdf <https://github.com/qoda/python-wkhtmltopdf>`__,
where this repo forked from, it tried to prase args. But it only include
a small set of the arguments the command supports. Furthermore, it set
default values to this set of arguments and pass them all to the
command. For me, it is totally unnecessary and even mistakeful. There is
default setting setup and doc in the command. Some arugments may not
even work together, as ``--page-size`` and ``--page-height``,
``--page-width``. So my solution is just pass the option in as a string,
Lazy, flexible and effective.
from class:
~~~~~~~~~~~
.. code:: python
from wkhtmltopdfwrapper import WKHtmlToPdf
wkhtmltopdf = WKHtmlToPdf('-T 20 -B 20 -g --zoom 1.5')
# option_string
wkhtmltopdf.render('http://www.example.com', '~/example.pdf')
# source url, output file path
from method:
~~~~~~~~~~~~
.. code:: python
from wkhtmltopdfwrapper import wkhtmltopdf
wkhtmltopdf('example.com', '~/example.pdf', '-T 20 -B 20 -g --zoom 1.5')
from commandline (installed):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: bash
$ python -m wkhtmltopdfwrapper.__init__ example.com ~/example.pdf -T 20 -B 20 -g --zoom 1.5
Authors:
========
- Jonathan Bydendyk (jpbydendyk@gmail.com)
- Weihong Guan (weihong.guan@gmail.com)
===================
A simple and direct python wrapper for the `wkhtmltopdf
lib <https://github.com/wkhtmltopdf/wkhtmltopdf>`__ inspired by inspired
by `Qoda's
python-wkhtmltopdf <https://github.com/qoda/python-wkhtmltopdf>`__
Requirements
------------
System:
~~~~~~~
- Linux 32/64 or OSX only (Windows is not supported at this stage)
- wkhtmltopdf
- python 2.5+ / python3
Installation
------------
wkhtmltopdf (Linux)
~~~~~~~~~~~~~~~~~~~
1. Install Fonts:
.. code:: bash
$ sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
2. Install wkhtmltopdf
goto http://wkhtmltopdf.org/downloads.html for the latest release
(Recommended)
wkhtmltopdf (OSX)
~~~~~~~~~~~~~~~~~
or goto http://wkhtmltopdf.org/downloads.html for the latest release
(Recommended)
wkhtmltopdf-wrapper (Any Platform)
----------------------------------
1. PIP:
.. code:: bash
$ pip install wkhtmltopdf-wrapper
or
.. code:: bash
$ pip install git+https://github.com/aguegu/wkhtmltopdf-wrapper.git
2. Development:
.. code:: bash
$ git clone https://github.com/aguegu/wkhtmltopdf-wrapper.git
$ cd wkhtmltopdf-wrapper
$ virtualenv .
$ pip install -r requirements.pip
Usage
=====
the option\_string would be sent to the wkhtmltopdf command line in
exactly the same shape. so the options can be anything as long as the
wkhtmltopdf supports. check its
`usage <http://wkhtmltopdf.org/usage/wkhtmltopdf.txt>`__. This lib is
just as simple as that. If anything goes wrong, just check the doc. If
the command execute ok with wkhtmltopdf dircetly, this wrapper should
work too.
As I check
`qoda/python-wkhtmltopdf <https://github.com/qoda/python-wkhtmltopdf>`__,
where this repo forked from, it tried to prase args. But it only include
a small set of the arguments the command supports. Furthermore, it set
default values to this set of arguments and pass them all to the
command. For me, it is totally unnecessary and even mistakeful. There is
default setting setup and doc in the command. Some arugments may not
even work together, as ``--page-size`` and ``--page-height``,
``--page-width``. So my solution is just pass the option in as a string,
Lazy, flexible and effective.
from class:
~~~~~~~~~~~
.. code:: python
from wkhtmltopdfwrapper import WKHtmlToPdf
wkhtmltopdf = WKHtmlToPdf('-T 20 -B 20 -g --zoom 1.5')
# option_string
wkhtmltopdf.render('http://www.example.com', '~/example.pdf')
# source url, output file path
from method:
~~~~~~~~~~~~
.. code:: python
from wkhtmltopdfwrapper import wkhtmltopdf
wkhtmltopdf('example.com', '~/example.pdf', '-T 20 -B 20 -g --zoom 1.5')
from commandline (installed):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: bash
$ python -m wkhtmltopdfwrapper.__init__ example.com ~/example.pdf -T 20 -B 20 -g --zoom 1.5
Authors:
========
- Jonathan Bydendyk (jpbydendyk@gmail.com)
- Weihong Guan (weihong.guan@gmail.com)
Release files for wkhtmltopdf-wrapper 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wkhtmltopdf-wrapper-0.3.3.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wkhtmltopdf_wrapper-0.3.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / wkhtmltopdf-wrapper-0.3.3.tar.gz
| Download URL | wkhtmltopdf-wrapper-0.3.3.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e0953f409656ca1502152e0a312504b23fd2f7da1f1dc6a48f331ff52709331
|
|
BLAKE2b-256 checksum How to use checksums |
0484590e4a486ae56d5e95af7c52d07aa486f5b044b74bf4abaa4a3e2d9c2cb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / wkhtmltopdf_wrapper-0.3.3-py2.py3-none-any.whl
| Download URL | wkhtmltopdf_wrapper-0.3.3-py2.py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
dcb8a9cd50d5811f91cf632761fa8d0759e0e2d7f5ad83da0b0671e2f870aedb
|
|
BLAKE2b-256 checksum How to use checksums |
fc369c8c162292bd4834a87d1f4dbc5793a778774eff4ffce61e3cdbb4411ded
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |