Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 147b61e

Browse files
committed
added 'acceptance' test
1 parent ca0f785 commit 147b61e

File tree

3 files changed

+162
-5
lines changed

3 files changed

+162
-5
lines changed

test/cookbook.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
Most people know how to write a page with HTML and CSS. Why not using these skills to dynamically generate PDF documents using it? The "pisa" project http://www.htmltopdf.org enables you to to this quite simple.
2525
"""
2626

27-
import cStringIO
28-
import ho.pisa as pisa
29-
import os
27+
from xhtml2pdf import pisa
28+
import cStringIO as StringIO
3029

3130
# Shortcut for dumping all logs to the screen
3231
pisa.showLogging()
@@ -40,7 +39,7 @@ def HTML2PDF(data, filename, open=False):
4039
"""
4140

4241
pdf = pisa.CreatePDF(
43-
cStringIO.StringIO(data),
42+
StringIO.StringIO(data),
4443
file(filename, "wb"))
4544

4645
if open and (not pdf.err):
@@ -72,4 +71,4 @@ def HTML2PDF(data, filename, open=False):
7271
</body></html>
7372
"""
7473

75-
HTML2PDF(HTMLTEST, "test.pdf", open=True)
74+
HTML2PDF(HTMLTEST, "test.pdf", open=False)

0 commit comments

Comments
 (0)