[Checkins] SVN: zopyx.convert2/trunk/ updated
Andreas Jung
andreas at andreas-jung.com
Sun Jun 5 11:01:10 EDT 2011
Log message for revision 121863:
updated
Changed:
U zopyx.convert2/trunk/CHANGES.txt
U zopyx.convert2/trunk/setup.py
U zopyx.convert2/trunk/src/zopyx/convert2/__init__.py
A zopyx.convert2/trunk/src/zopyx/convert2/pisa.py
-=-
Modified: zopyx.convert2/trunk/CHANGES.txt
===================================================================
--- zopyx.convert2/trunk/CHANGES.txt 2011-06-05 14:58:15 UTC (rev 121862)
+++ zopyx.convert2/trunk/CHANGES.txt 2011-06-05 15:01:09 UTC (rev 121863)
@@ -1,3 +1,7 @@
+2.3.0 (2011-06-05)
+==================
+- support for PISA (pdf-pisa)
+
2.2.5 (2011-04-03)
==================
- calibre converter now honors the commandlineoptions.txt file
Modified: zopyx.convert2/trunk/setup.py
===================================================================
--- zopyx.convert2/trunk/setup.py 2011-06-05 14:58:15 UTC (rev 121862)
+++ zopyx.convert2/trunk/setup.py 2011-06-05 15:01:09 UTC (rev 121863)
@@ -12,7 +12,7 @@
'Programming Language :: Python',
]
-version = '2.2.5'
+version = '2.3.0'
desc = unicode(file('README.txt').read().strip(), 'utf-8')
changes = file('CHANGES.txt').read().strip()
@@ -35,7 +35,14 @@
include_package_data = True,
test_suite='nose.collector',
zip_safe=False,
- install_requires=['setuptools', 'elementtree', 'BeautifulSoup<=3.0.9999'],
+ install_requires=[
+ 'setuptools',
+ 'elementtree',
+ 'BeautifulSoup<=3.0.9999',
+ 'pisa',
+ 'reportlab',
+ 'pypdf',
+ 'html5lib'],
namespace_packages=['zopyx'],
entry_points={'console_scripts': ['html-convert = zopyx.convert2.cli:main',]},
)
Modified: zopyx.convert2/trunk/src/zopyx/convert2/__init__.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/__init__.py 2011-06-05 14:58:15 UTC (rev 121862)
+++ zopyx.convert2/trunk/src/zopyx/convert2/__init__.py 2011-06-05 15:01:09 UTC (rev 121863)
@@ -11,6 +11,7 @@
import prince
import xfc
import calibre
+import pisa
from convert import Converter
Copied: zopyx.convert2/trunk/src/zopyx/convert2/pisa.py (from rev 121862, zopyx.convert2/branches/pisa/src/zopyx/convert2/pisa.py)
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/pisa.py (rev 0)
+++ zopyx.convert2/trunk/src/zopyx/convert2/pisa.py 2011-06-05 15:01:09 UTC (rev 121863)
@@ -0,0 +1,55 @@
+##########################################################################
+# zopyx.convert2 - SmartPrintNG low-level functionality
+#
+# (C) 2007, 2008, ZOPYX Ltd & Co. KG, Tuebingen, Germany
+##########################################################################
+
+import os
+import sys
+
+from convert import BaseConverter
+from util import runcmd, which, win32, checkEnvironment, newTempfile, execution_shell
+from logger import LOG
+
+from exceptions import ConversionError
+from sx.pisa3.pisa_document import pisaDocument
+
+
+def html2pdf(html_filename, output_filename=None, **options):
+ """ Convert a HTML file to PDF using FOP"""
+
+ if not output_filename:
+ output_filename = newTempfile(suffix='.pdf')
+
+ fin = file(html_filename)
+ fout = file(output_filename, 'wb')
+ pdf = pisaDocument(fin,
+ fout,
+ encoding='utf-8',
+ debug=True)
+
+ fin.close()
+ fout.close()
+ return dict(output_filename=output_filename,
+ status=0,
+ output='')
+
+
+class HTML2PDF(BaseConverter):
+
+ name = 'pdf-pisa'
+ output_format = 'pdf'
+ visible_name = 'PDF (PISA)'
+ visible = True
+
+ @staticmethod
+ def available():
+ return True
+
+ def convert(self, output_filename=None, **options):
+ result = html2pdf(self.filename, output_filename, **options)
+ return result
+
+from registry import registerConverter
+registerConverter(HTML2PDF)
+
More information about the checkins
mailing list