[Checkins] SVN: zopyx.convert2/trunk/ added support for pdf-pisa-bin transformation

Andreas Jung andreas at andreas-jung.com
Wed Jun 15 04:01:02 EDT 2011


Log message for revision 121940:
  added support for pdf-pisa-bin transformation
  

Changed:
  U   zopyx.convert2/trunk/CHANGES.txt
  U   zopyx.convert2/trunk/src/zopyx/convert2/__init__.py
  A   zopyx.convert2/trunk/src/zopyx/convert2/pisa_bin.py

-=-
Modified: zopyx.convert2/trunk/CHANGES.txt
===================================================================
--- zopyx.convert2/trunk/CHANGES.txt	2011-06-15 05:40:52 UTC (rev 121939)
+++ zopyx.convert2/trunk/CHANGES.txt	2011-06-15 08:01:01 UTC (rev 121940)
@@ -1,3 +1,8 @@
+2.3.1 (2011-06-15)
+==================
+- support for PISA (pdf-pisa-bin) - requires that 'pisa'
+  is found in the $PATH
+ 
 2.3.0 (2011-06-05)
 ==================
 - support for PISA (pdf-pisa)

Modified: zopyx.convert2/trunk/src/zopyx/convert2/__init__.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/__init__.py	2011-06-15 05:40:52 UTC (rev 121939)
+++ zopyx.convert2/trunk/src/zopyx/convert2/__init__.py	2011-06-15 08:01:01 UTC (rev 121940)
@@ -12,6 +12,7 @@
 import xfc
 import calibre
 import pisa
+import pisa_bin
 from convert import Converter
 
 

Copied: zopyx.convert2/trunk/src/zopyx/convert2/pisa_bin.py (from rev 121939, zopyx.convert2/trunk/src/zopyx/convert2/pisa.py)
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/pisa_bin.py	                        (rev 0)
+++ zopyx.convert2/trunk/src/zopyx/convert2/pisa_bin.py	2011-06-15 08:01:01 UTC (rev 121940)
@@ -0,0 +1,49 @@
+##########################################################################
+# 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')
+
+    cmd = 'pisa --encoding utf-8 -d "%s" "%s"' % (html_filename, output_filename)
+    status, output = runcmd(cmd)
+    
+    return dict(output_filename=output_filename,
+                status=0,
+                output=output)
+
+
+class HTML2PDF(BaseConverter):
+
+    name = 'pdf-pisa-bin'
+    output_format = 'pdf'
+    visible_name = 'PDF (PISA, binary binary converter)'
+    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