Latest recipes tagged "publishing"http://code.activestate.com/recipes/tags/publishing/new/2013-12-16T21:49:33-08:00ActiveState Code RecipesCreate 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>