Skip to main content

A Python interface to XSL-FO libraries (Conversion HTML to PDF, RTF, DOCX, WML and ODT)

Project description

The zopyx.convert package helps you to convert HTML to PDF, RTF, ODT, DOCX and WML using XSL-FO technology.

Requirements

  • XFC-4.0 (XMLMind) for ODT, RTF, DOCX and WML support

Installation

  • install zopyx.convert either using easy_install or by downloading the sources from the Python Cheeseshop

  • the environment variable $XFC_DIR must be set and point to the root of your XFC installation directory

  • the environment variable $XINC_HOME must be set and to point to the root of your XINC installation directory

Subversion repository

Usage

Some examples from the Python command-line:

from zopyx.convert import Converter
C = Convert('/path/to/some/file.html')
pdf_filename = C('pdf')
rtf_filename = C('rtf')
pdt_filename = C('odt')
wml_filename = C('wml')
docx_filename = C('docx')

A very simple command-line converter is also available:

xslfo-convert --format rtf --output foo.rtf sample.html

How zopyx.convert works internally

  • The source HTML file is converted to XHTML using mxTidy

  • the XHTML file is converted to FO using the great “csstoxslfo” converter written by Werner Donne.

  • the FO file is passed either to the external XINC or XFC converter to generated the desired output format

  • all converters are based on Java technology make the conversion solution highly portable across operating system (including Windows)

Limitations

zopyx.convert works currently only on Linux/Unix, no Windows support so far

Why XINC/XFC and not FOP?

zopyx.convert is build on the commercial converters XINC/XFC because these converters just work. Depending on your needs to must make your choice between the several available additions. Why not Apache FOP? FOP has been evaluated in 2004 for the conversion to RTF/PDF and it was pretty much unusable at that time. Now in 2007 Apache FOP reached version 0.9.3 thinks are looking better. However open formats like ODT (Open-Office) and DOCX (Microsoft Office 2007) have come up and need to be supported. XFC fills the gap by supporting RTF, ODT, DOCX and WML.

Author

zopyx.convert was written by Andreas Jung for ZOPYX Ltd. & Co. KG, Tuebingen, Germany.

License

zopyx.convert is published under the Lesser GNU Public License V 2.1 (LGPL 2.1). See LICENSE.txt.

Contact

ZOPYX Ltd. & Co. KG
c/o Andreas Jung,
Charlottenstr. 37/1
D-72070 Tuebingen, Germany
E-mail: info at zopyx dot com

Changes:

1.0.3 (04.10.2007)

  • passing -Duser.language=en to java in order to prevent corrupted FO code caused by locales

1.0.2 (03.10.2007)

  • bugfix

1.0.1 (03.10.2007)

  • added –test option to command-line frontend

1.0.0 (30.09.2007)

  • update to css2xslfo V 1.5.0

  • official 1.0.0 release

0.5.0 (09.09.2007)

  • replaced mxTidy related code with the BeautifulSoup module (no longer requires any compiling)

  • html2fo checks the existence of images

0.4.9 (25.07.2007)

  • support for utidy lib (which is the preferred tidy library). Using mx.Tidy only as fallback

0.4.8 (unreleased)

  • unreleased

0.4.7 (08.07.2007)

  • reSTified documentation

0.4.6 (08.07.2007)

  • fixes in availableFormats()

0.4.5 (07.07.2007)

  • various FO fixes

0.4.4 (06.07.2007)

  • using logging module

0.4.3 (05.07.2007)

  • html2fo: using ElementTree for most FO modifications

0.4.2 (30.06.2007)

  • converting page-break-after: always back into break-after: page

0.4.1 (24.06.2007)

  • various fixes

0.4.0 (24.06.2007)

  • added zope interfaces

  • converters are now classes

  • added unittests

0.3.1 (18.06.2007)

  • html2fo() and the converter constructor got a new ‘encoding’ parameter in order to specify the input encoding of the HTML file. This parameter will be passed down to Tidy in order to perform a proper conversion of non-ascii characters.

0.3.0 (unreleased)

  • using subprocess module of Python

  • new Convert() class for high-level XSLFO access

  • logger added

  • better checks for XINC, XFC

  • updated documentation

0.2.0 (16.06.2007)

  • PDF support added

  • command line interface added

  • mxTidy integration

0.1.0 (16.06.2007)

  • initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zopyx.convert-1.0.3.tar.gz (353.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zopyx.convert-1.0.3-py2.4.egg (370.7 kB view details)

Uploaded Egg

File details

Details for the file zopyx.convert-1.0.3.tar.gz.

File metadata

  • Download URL: zopyx.convert-1.0.3.tar.gz
  • Upload date:
  • Size: 353.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zopyx.convert-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4fb24cbe20d31181b5bbfdcadf8f7b3436cb8423edbc0cacdacc6f5fd0197711
MD5 cd14d46da63cad120be39abaf4b616de
BLAKE2b-256 b96fc13a328ddfa6b8a49bb078b4d5ebd3a8cd9d81414b28936c6a5c27d61a7e

See more details on using hashes here.

File details

Details for the file zopyx.convert-1.0.3-py2.4.egg.

File metadata

File hashes

Hashes for zopyx.convert-1.0.3-py2.4.egg
Algorithm Hash digest
SHA256 16aa851c59eae862aa8a69cb8b34482fe4bbb64a03155cefbc15fd141424b61f
MD5 68973b419bacdf1e536c54d2f27cd368
BLAKE2b-256 49821179ef0a2a332eef183d6dc7bbfb7d40ece3d185c6a61045d4f9f0b39414

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page