Questions tagged [pisa]

Pisa is a Python HTML/XHTML/CSS to PDF converter

Pisa is a HTML/XHTML/CSS to PDF converter written in Python and based on Reportlab Toolkit, pyPDF, TechGame Networks CSS Library and HTML5lib

119 questions
5
votes
1 answer

Paginating in Pisa (xhtml2pdf) just repeats last page

I am using Pisa to produce a PDF file with pages that follow a common format. I am clearly doing something wrong as when I generate the PDF (either from from the command line or from the python API) I only ever see the last page repeated. Running…
ChrisGuest
  • 3,398
  • 4
  • 32
  • 53
4
votes
1 answer

Django pdf: page layout with long texts using pisa

I use pisa to generate some PDF files of the following layout: @page { size: a4; @frame header { top: 5.4cm; bottom: 4cm; left: 1.2cm; right: 1.2cm; } @frame main { …
Kassandra
  • 41
  • 1
  • 2
4
votes
1 answer

TypeError: unsupported operand type(s) for -: 'str' and 'int' while using pisa.Createpdf

import email, sys, os from xhtml2pdf import pisa def convertHtmlToPdf(sourceHtml, outputFilename): resultFile = open(outputFilename, "wb") pisaStatus = pisa.CreatePDF(sourceHtml,resultFile) resultFile.close() return #a =
usurexc
  • 71
  • 1
  • 3
4
votes
2 answers

trouble using xhtml2pdf with unicode

I've been trying to convert Hebrew html files without success; the Hebrew characters show up in the output PDF as black rectangles regardless of any encoding I tried. I tried some unicode test files included in the pisa distribution:…
user490616
  • 41
  • 1
  • 3
4
votes
1 answer

No handlers could be found for logger "xhtml2pdf"

I'm using xhtmltopdf.pisa for generating pdf from html template. The code was working fine. pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("UTF-8")), dest=result, link_callback=fetch_resources, default_css=open(pdf_css_path, 'r').read()) But…
user3397882
  • 107
  • 1
  • 6
4
votes
1 answer

Setting background color in xhtml2pdf

I have a problem with setting background-color using xhtml2pdf library. I want to create specific size element and I do it with success by @frame keyword like this: @frame r1c1_frame { left: 35pt; width: 262pt; top: 35pt; height:…
sztubi
  • 41
  • 5
4
votes
1 answer

application/pdf pisa __init__() got an unexpected keyword argument 'mime type'

this is the code: def render_to_pdf(template_src, context_dict): template = get_template(template_src) context = Context(context_dict) html = template.render(context) result = StringIO.StringIO() pdf =…
Stefano Ruzza
  • 93
  • 1
  • 2
  • 9
4
votes
1 answer

How to use Pisa on Google App Engine to generate PDF from HTML/CSS

I'm developing a simple GAE application that crawls some data from a given site and presenst it formatted in html/css. What I would like to do now is to offer an Export to PDF feature trasforming the formatted html/css to PDF. I've imported…
systempuntoout
  • 71,966
  • 47
  • 171
  • 241
3
votes
2 answers

How to convert SVG images for use with Pisa / XHTML2PDF?

I'm using Pisa/XHTML2PDF to generate PDFs on the fly in Django. Unfortunately, I need to include SVG images as well, which I don't believe is an easy task. What's the best way to go about either a) converting the SVGs to PNG / JPG (in Python) or b)…
Nick Sergeant
  • 35,843
  • 12
  • 36
  • 44
3
votes
1 answer

need xhtml2pdf (Pisa 3.0) css syntax for @page and @frame

i'm trying stuff out with xhtml2pdf (aka Pisa 3.0) and django and am having trouble with the css http://www.xhtml2pdf.com/doc/pisa-en.html obviously the docs above talk about the css that is available as well as vendor specific tags. If i follow the…
w--
  • 6,427
  • 12
  • 54
  • 92
3
votes
1 answer

Using an image URL for link_callback in the pisa html to pdf library

Related to: django - pisa : adding images to PDF output I've got a site that uses the Google Chart API to display a bunch of reports to the user, and I'm trying to implement a PDF version. I'm using the link_callback parameter in pisa.pisaDocument…
Dan Breen
  • 12,626
  • 4
  • 38
  • 49
3
votes
1 answer

How to repeat a with Pisa (xhtml2pdf)

I'm generating a PDF from HTML using Pisa. The pisa documentation (section 11.3) says that it is possible to repeat a row "It is possible to repeat table rows if a page break occurs within a table. The number of repeated rows is passed in the…
Chris
  • 2,619
  • 6
  • 27
  • 34
3
votes
2 answers

Reading PISA data into R - read.table error

I am trying to read data from the PISA 2012 study (http://pisa2012.acer.edu.au/downloads.php) into R using the read.table function. This is the code I tried: pisa <- read.table("pisa2012.txt", sep = "") unfortunately I keep getting the…
sascha91
  • 31
  • 1
3
votes
0 answers

Python Pisa shrunk text in table

I am working on a work related problem and I seem to have got stuck on HTML to PDF conversion. I have an XML that is being converted to HTML and this HTML file has a portion of text which looks like
Large amount of text.…
Arpit Jain
  • 41
  • 2
3
votes
2 answers

How to change page size in pdf generated by pisa

I am creating pdf from my html page using pisa in django framework. Can anyone please tell me how to adjust the pdf page size. I tried to use A5 but its not reflecting. Please find the code below: context_dict = { …
vlad halmer
  • 1,211
  • 2
  • 16
  • 21