Popular recipes tagged "meta:requires=xtopdf"http://code.activestate.com/recipes/tags/meta:requires=xtopdf/2015-10-07T18:02:46-07:00ActiveState Code RecipesGenerate a PDF invoice with xtopdf and Python (Python)
2015-10-07T18:02:46-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579108-generate-a-pdf-invoice-with-xtopdf-and-python/
<p style="color: grey">
Python
recipe 579108
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows the basics of how to generate invoices as PDF documents, using xtopdf, a Python toolkit for PDF creation. An example of creating a simple invoice through Python and xtopdf code is shown. </p>
<p>xtopdf is available on Bitbucket at:</p>
<p><a href="https://bitbucket.org/vasudevram/xtopdf" rel="nofollow">https://bitbucket.org/vasudevram/xtopdf</a></p>
<p>and you can find many links with examples of using xtopdf, how to install it, etc., from this Google search:</p>
<p><a href="https://google.com/search?q=xtopdf" rel="nofollow">https://google.com/search?q=xtopdf</a></p>
<p>This sub-feed of my blog:</p>
<p><a href="http://jugad2.blogspot.com/search/label/xtopdf" rel="nofollow">http://jugad2.blogspot.com/search/label/xtopdf</a></p>
<p>gives access to all my blog posts labelled xtopdf.</p>
Convert HTML text to PDF with Beautiful Soup and xtopdf (Python)
2015-01-28T22:20:53-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579014-convert-html-text-to-pdf-with-beautiful-soup-and-x/
<p style="color: grey">
Python
recipe 579014
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/format/">format</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportgeneration/">reportgeneration</a>, <a href="/recipes/tags/reporting/">reporting</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to convert the text in an HTML document to PDF. It uses the Beautiful Soup and xtopdf Python libraries. Beautiful Soup is a library for HTML parsing and content extraction. xtopdf is a library for PDF creation from other formats, including text and many others.</p>
Publish databases to PDF with PyDAL (a Python DB library) and xtopdf (Python)
2015-01-15T16:09:27-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579004-publish-databases-to-pdf-with-pydal-a-python-db-li/
<p style="color: grey">
Python
recipe 579004
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pydal/">pydal</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python_developer_tools/">python_developer_tools</a>, <a href="/recipes/tags/sql/">sql</a>, <a href="/recipes/tags/web2py/">web2py</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to use the PyDAL database library for Python, together with xtopdf, a PDF creation library for Python, to publish database data to PDF. PyDAL was earlier a part of the web2py Python web framework, and then was split out into a separate library that does not need to be used with web2py. It supports access to many popular relational databases, both open source and proprietary.</p>
Print selected text pages to PDF with Python, selpg and xtopdf on Linux (Bash)
2014-10-29T17:38:10-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578954-print-selected-text-pages-to-pdf-with-python-selpg/
<p style="color: grey">
Bash
recipe 578954
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/text_files/">text_files</a>, <a href="/recipes/tags/text_processing/">text_processing</a>, <a href="/recipes/tags/unix/">unix</a>).
</p>
<p>This recipe shows how to use selpg, a Linux command-line utility written in C, together with xtopdf, a Python toolkit for PDF creation, to print only a selected range of pages from a text file, to a PDF file, for display or print purposes. The way to do this is to run the selpg utility at the Linux command line, with options specifying the start and end pages of the range, and pipe its output to the StdinToPDF.py program, which is a part of the xtopdf toolkit.</p>
Serve PDF with Netius, a pure-Python network library, and xtopdf (Python)
2014-12-03T21:27:54-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578974-serve-pdf-with-netius-a-pure-python-network-librar/
<p style="color: grey">
Python
recipe 578974
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/client/">client</a>, <a href="/recipes/tags/client_server/">client_server</a>, <a href="/recipes/tags/networking/">networking</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/server/">server</a>).
</p>
<p>This recipe shows how to serve PDF from a server written using Netius, a pure-Python library, together with xtopdf, a Python toolkit for PDF creation. It is a proof-of-concept recipe, to show the essentials needed for the task, so it hard-codes the text content that is served as PDF, but the concepts shown can easily be extended to serve dynamically generated PDF content.</p>
Convert Microsoft Word files to PDF with DOCXtoPDF (Python)
2013-12-24T23:03:43-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578795-convert-microsoft-word-files-to-pdf-with-docxtopdf/
<p style="color: grey">
Python
recipe 578795
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/docx/">docx</a>, <a href="/recipes/tags/microsoft/">microsoft</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/word/">word</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>Yhis recipe shows how to convert Microsoft Word .DOCX files to PDF format, using the python-docx library and my xtopdf toolkit for PDF creation.</p>
<p>Note: The recipe has some limitations. E.g. fonts, tables, etc. from the input DOCX file are not preserved in the output PDF file.</p>
Use PDFWriter with context manager support (Python)
2013-12-16T21:43:27-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578790-use-pdfwriter-with-context-manager-support/
<p style="color: grey">
Python
recipe 578790
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/contextmanager/">contextmanager</a>, <a href="/recipes/tags/context_manager/">context_manager</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/with_statement/">with_statement</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>PDFWriter - a core class of the xtopdf toolkit - can now be used with a Python context manager, a.k.a. the Python <strong>with</strong> statement.</p>
<p>Code example below. More details here:</p>
<p><a href="http://jugad2.blogspot.in/2013/12/xtopdf-pdfwriter-now-has-context.html" rel="nofollow">http://jugad2.blogspot.in/2013/12/xtopdf-pdfwriter-now-has-context.html</a></p>
Create simple PDF text calendars with xtopdf (Python)
2014-02-14T22:33:04-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578832-create-simple-pdf-text-calendars-with-xtopdf/
<p style="color: grey">
Python
recipe 578832
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to create simple text calendars as PDF using xtopdf, a Python toolkit for PDF creation.</p>
Publish Berkeley DB data to PDF with xtopdf (Python)
2014-01-24T17:57:21-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578814-publish-berkeley-db-data-to-pdf-with-xtopdf/
<p style="color: grey">
Python
recipe 578814
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/bsddb/">bsddb</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to convert the data stored in a Berkeley DB database to PDF, using the xtopdf toolkit for PDF creation.
It should work on either Linux/Unix or Windows.</p>
Create PDF at the end of a Unix pipeline with PDFWriter (Python)
2013-12-22T22:19:00-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578794-create-pdf-at-the-end-of-a-unix-pipeline-with-pdfw/
<p style="color: grey">
Python
recipe 578794
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pipelining/">pipelining</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/unix/">unix</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to create PDF output at the end of a Unix or Linux pipeline, after all the text processing required, is done by previous components of the pipeline (which can use any of the standard tools of Unix such as sed, grep, awk, etc., as well as custom programs that act as filters).</p>
A basic WSGI PDF server (Python)
2013-12-26T18:45:35-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578798-a-basic-wsgi-pdf-server/
<p style="color: grey">
Python
recipe 578798
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/wsgi/">wsgi</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to create a rudimentary Python WSGI server that can serve PDF. I had seen a post on the Python Reddit about how to create 'a basic WSGI server (aka "enough to make a website without using a framework")'. Thought of modifying it to serve PDF content (hard-ccded, though, not dynamic content, just as a basic example). This is the result. It's meant for learning, as was the original from which it was adapted, not for production use. It requires my xtopdf toolkit and the Reportlab toolkit, v1.21</p>
Create a Table of Contents for an ebook with XMLtoPDFBook (Python)
2013-12-16T21:49:33-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578791-create-a-table-of-contents-for-an-ebook-with-xmlto/
<p style="color: grey">
Python
recipe 578791
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/ebooks/">ebooks</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/publishing/">publishing</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>XMLtoPDFBook is a tool that allows you to create simple PDF ebooks from XML content. It is a part of the xtpodf toolkit.</p>
<p>You can now create PDF ebooks with XMLtoPDFBook, that include a Table of Contents (TOC).</p>
XML to PDF book with ElementTree and xtopdf (Python)
2013-06-16T19:14:58-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578561-xml-to-pdf-book-with-elementtree-and-xtopdf/
<p style="color: grey">
Python
recipe 578561
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/ebooks/">ebooks</a>, <a href="/recipes/tags/elementtree/">elementtree</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/publishing/">publishing</a>, <a href="/recipes/tags/xml/">xml</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to create a PDF book from XML text content. It requires my xtopdf toolkit, the ElementTree module (from Python's standard library) and the open source version of the ReportLab toolkit.</p>
<p>Create an XML template file like this:</p>
<p><?xml version="1.0"?>
<book>
<chapter>
Chapter 1 content here.
</chapter></p>
<pre class="prettyprint"><code> <chapter>
Chapter 2 content here.
</chapter>
</code></pre>
<p></book></p>
<p>Then populate the chapter elements with the text of each of the chapters of your book, as text. Call that file, your_book.xml, say.</p>
<p>Then run:</p>
<p>python XMLtoPDFBook.py your_book.xml your_book.pdf</p>
<p>Now the contents of your book will be in your_book.pdf</p>
<p>More details and the full code here:</p>
<p><a href="http://jugad2.blogspot.in/2013/06/create-pdf-books-with-xmltopdfbook.html" rel="nofollow">http://jugad2.blogspot.in/2013/06/create-pdf-books-with-xmltopdfbook.html</a></p>
<ul>
<li>Vasudev Ram
<a href="http://dancingbison.com" rel="nofollow">dancingbison.com</a></li>
</ul>