Skip to content

Commit ab1ca1e

Browse files
committed
update readme and setup.py
1 parent 2346dc4 commit ab1ca1e

File tree

2 files changed

+41
-29
lines changed

2 files changed

+41
-29
lines changed

README.md

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
pydf
22
====
33

4-
PDF generation in python using [wkhtmltopdf](http://wkhtmltopdf.org/) suitable for Heroku.
4+
PDF generation in python using [wkhtmltopdf](http://wkhtmltopdf.org/).
5+
6+
Wkhtmltopdf binaries are precompiled and included in the package making pydf easier to use,
7+
in particular this means pydf works on heroku.
58

69
Based on [pywkher](https://github.com/jwmayfield/pywkher) but significantly extended.
710

811
Currently using **wkhtmltopdf v. 0.12.2** (beta).
912

13+
## Install
14+
15+
pip install python-pdf
16+
17+
(pydf was taken, but I guess python-pdf is a clearer name anyway.)
18+
1019
## Basic Usage
1120

12-
import pydf
13-
pdf = pydf.generate_pdf('<h1>this is html</h1>')
14-
open('test_doc.pdf', 'w').write(pdf)
21+
```python
22+
import pydf
23+
pdf = pydf.generate_pdf('<h1>this is html</h1>')
24+
open('test_doc.pdf', 'w').write(pdf)
1525

16-
pdf = pydf.generate_pdf('www.google.com')
17-
open('google.pdf', 'w').write(pdf)
26+
pdf = pydf.generate_pdf('www.google.com')
27+
open('google.pdf', 'w').write(pdf)
28+
```
1829

1930
## API
2031

@@ -36,21 +47,21 @@ and None arguments are missed, everything else is passed with str(value).
3647

3748
**Arguments:**
3849

39-
* source: html string to generate pdf from or url to get
40-
* quiet: bool
41-
* grayscale: bool
42-
* lowquality: bool
43-
* margin_bottom: string eg. 10mm
44-
* margin_left: string eg. 10mm
45-
* margin_right: string eg. 10mm
46-
* margin_top: string eg. 10mm
47-
* orientation: Portrait or Landscape
48-
* page_height: string eg. 10mm
49-
* page_width: string eg. 10mm
50-
* page_size: string: A4, Letter, etc.
51-
* image_dpi: int default 600
52-
* image_quality: int default 94
53-
* extra_kwargs: any exotic extra options for wkhtmltopdf
50+
* `source`: html string to generate pdf from or url to get
51+
* `quiet`: bool
52+
* `grayscale`: bool
53+
* `lowquality`: bool
54+
* `margin_bottom`: string eg. 10mm
55+
* `margin_left`: string eg. 10mm
56+
* `margin_right`: string eg. 10mm
57+
* `margin_top`: string eg. 10mm
58+
* `orientation`: Portrait or Landscape
59+
* `page_height`: string eg. 10mm
60+
* `page_width`: string eg. 10mm
61+
* `page_size`: string: A4, Letter, etc.
62+
* `image_dpi`: int default 600
63+
* `image_quality`: int default 94
64+
* `extra_kwargs`: any exotic extra options for wkhtmltopdf
5465

5566
Returns string representing pdf
5667

@@ -68,6 +79,6 @@ uses -h command line option
6879
get extended help string from wkhtmltopdf binary
6980
uses -H command line option
7081

71-
### execute_wk(*args)
82+
#### execute_wk(*args)
7283

7384
Low level function to call wkhtmltopdf, arguments are added to wkhtmltopdf binary and passed to subprocess with not processing.

setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
#!/usr/bin/python
2-
3-
import os, re
4-
1+
import sys
52
from setuptools import setup
63

74
description = 'PDF generation in python using wkhtmltopdf suitable for heroku'
5+
long_description = description
6+
if 'upload' in sys.argv or 'register' in sys.argv:
7+
import pypandoc
8+
long_description = pypandoc.convert('README.md', 'rst')
89

910
setup(
10-
name='pydf',
11+
name='python-pdf',
1112
version='0.2',
1213
description=description,
14+
long_description=long_description,
1315
author='Samuel Colvin',
1416
license='MIT',
1517
author_email='[email protected]',
@@ -24,12 +26,11 @@
2426
'License :: OSI Approved :: BSD License',
2527
'Operating System :: OS Independent',
2628
'Programming Language :: Python',
27-
'Programming Language :: Python :: 2.6',
2829
'Programming Language :: Python :: 2.7',
2930
'Topic :: Internet :: WWW/HTTP',
3031
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3132
'Topic :: Software Development :: Libraries :: Python Modules',
3233
],
3334
test_suite='tests',
3435
zip_safe=False
35-
)
36+
)

0 commit comments

Comments
 (0)