Skip to content

Instantly share code, notes, and snippets.

View george-silva's full-sized avatar
🌊

George Silva george-silva

🌊
View GitHub Profile
@george-silva
george-silva / gist:3228697
Created August 1, 2012 16:54 — forked from gmorada/gist:3228519
Helper para gerar relatório em pdf a partir de um html
from django.template.loader import get_template
from django.template import Context
import cStringIO as StringIO
import cgi
import ho.pisa as pisa
def render_to_pdf(template_src, context_dict):
template = get_template(template_src)
context = Context(context_dict)
html = template.render(context)
<!DOCTYPE html>
<html>
<head>
<title>SIG SMTT</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init(){
map = new OpenLayers.Map('map');