A Python Solution for Making Custom PDFs from HTML

December 22, 2015 9:51 a.m.

The client wanted to give their users the option of printing completed forms to a pdf file. They also wanted the pdf to be rendered with formatting and style that varied slightly from the online display of the completed form, and so desired a solution other than the browser’s own print function. The open-source Reportlab library is a popular solution for generating on-the-fly pdfs, and the xhtml2pdf library, which depends on Reportlab, offers a relatively easy way to convert an html web page to pdf while (more-or-less) preserving css styles. For these reasons, we chose an approach using xhtml2pdf ...

Read More

Updated 12/22/15 @ 09:51AM CST by ntaylor

Bookmark and Share

Categories: User Interface

Tags: django pdf python reportlab


Django and IPython Notebook

May 05, 2014 10:48 a.m.

The IPython Notebook is a really cool application, and I've always wanted to use it during Django development and debugging.  The only problem is that it requires a lot of dependencies and I feel no need to encumber my production projects with those dependencies for a feature that I only plan to use in development on my desktop.  Specifically, the http version of IPython Notebook requires jinja2, tornado, pyzmq (and libzmq3), and markupsafe.  

Ideally, I'd be able to install these dependencies only for development, and recently I figured out a workable way to accomplish this.  I figured that ...

Read More

Updated 05/05/14 @ 10:48AM CDT by jjasinski

Bookmark and Share

Categories: System-level Tools

Tags: django_extensions ipython jinja libzmq32 markupsafe pyzmq shell_plus tornado ubuntu zeromq

Python Community Observations Retort

December 02, 2009 2 p.m.

I recently read an article by Steve Holden, chairman of the Python Software Foundation, titled Comments or Not? Public or Private? Relevant or Irrelevant?. It's a rather interesting read that I definitely recommend that covers the heated PyPi comments debate, issue tracking, and the surrounding Python community. There are also a number of insightful comments on this blog post, but I personally felt a lengthier blog post to be more fitting than a comment in retort.

First off, commenting on PyPi has stirred up quite a bit of debate. I personally feel that the pros are outweighed by the ...

Read More

Updated 12/02/09 @ 02:00PM CST by markr

Bookmark and Share

Categories: Community

Tags: community pypi python

Permission Based File Serving

November 17, 2009 3:15 p.m.

One issue I've run into a couple times while working with Django is the need to serve files to users based on permissions. The first situation occurred with a store we were building that would allow for electronic versions of books to be sold. These books would typically be distributed in PDF format but overall to the story, the format is irrelevant. In this scenario I needed to be able to take the ID of a book and return a PDF download to the user. However, I only wanted to do this if the user passed proper authentication and ...

Read More

Updated 11/17/09 @ 03:15PM CST by markr

Bookmark and Share

Categories: Security

Tags: apache django nginx permissions python user