Questions tagged [pisa]

1

votes
1

answer
1.2k

Views

Pisa and lastPage

Greetings, I'm using PISA to generate some nice pdf of my web pages. Anyway I'd need to put a footer div -only- in the last page of the pdf document. I found the tag '@page lastPage' in the official documentation but I can't make it work. I show you some of my code: @page { size: {{ pagesize }}; mar...
Flavio Marcato
1

votes
1

answer
515

Views

Exclude first page from Table of Contents in pisa / xhtml2pdf

I'm using django-xhtml2pdf to generate a report. I'm using the first page as a cover sheet, followed by the table of contents, using the tag. I would like to discount the first page, so the page-numbering in the Table of Contents starts at 1 instead of 2. Is this possible?
Rob Gibbons
1

votes
1

answer
900

Views

password protect pdf files created using pisa

I'm converting a html file into pdf using python pisa module. I need to password protect it. I searched everywhere in pisa module and couldn't find a solution for it. Is there anyway to password protect it using python? The constraint is I want keep my file in html format. On demand basis, I want to...
thavan
1

votes
1

answer
737

Views

How do I upload a pdf from a Django HTTP object to google drive

I use pisa to create pdf documents to render to the user: response = HttpResponse() pisa.CreatePDF(src=html, dest=response, show_error_as_pdf=True) return response response.content contains the pdf. I've used the dropbox-python sdk to do this: dropbox_client.put_file(folder_path, response.content) I...
rsp
1

votes
1

answer
3.7k

Views

Open a new browser window with PDF content returned from Python Pisa

I have a Javascript app. When I click on a button, a JSON object is sent using POST request to a Django-Pisa remote server to create a PDF file from the JSON object. I have to use POST since the JSON length is way over the GET allowable length. This is my Django render function @csrf_exempt def ren...
Nghi Vo
1

votes
1

answer
1.8k

Views

How to include html file inside Pisa document xhtml2pdf with python?

I'm new in xhtml2pdf with python , write html code with python in readable format is somehow cumbersome . I want to know how to include .html file in pisa document.Here is simple code in which I create pdf file: from xhtml2pdf import pisa def main(): filename = 'simplePrint.pdf' # generate co...
Zeb
1

votes
1

answer
1.1k

Views

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 = { 'pagesize':'A5', 'result_detail': obj.result_object(slug, roll_no), 'roll_no': roll_no...
vlad halmer
1

votes
2

answer
1.1k

Views

Python module Pisa: how change background color for all page?

How i can change background color of all page? like this : body,div { background-color:#f4f4f4; } Now background changes only for div with information, remaining page have white color. if it is possible, can you write example? P.s. How i can draw border around ?
user2876803
1

votes
1

answer
1.3k

Views

pisa html to pdf issue with greek stressed letters used with django

I am using pisa to generate a pdf from html in a django application. My view code is the following if request.method == 'POST': return write_to_pdf(request.POST['convert'], { }, 'file') where convert is a TextArea from which i get the value to write on my pdf file write_to_pdf def fetch_reso...
Apostolos
1

votes
2

answer
5k

Views

Install pisa on Ubuntu (django)

I'm trying to install pisa, I have all the requirements installed. I try import: import ho.pisa as pisa or: import xhtml2pd.pisa as pisa Error: ImportError Exception Value: No module named reportlab.lib.units Last traceback: from pisa_util import * from reportlab.lib.units import inch, cm I'm r...
user3044258
1

votes
1

answer
2.2k

Views

Optimize PDF conversion in Django / Python

I have a webapp that export reports in PDF. Everything is fine when the query returns less than 100 values. When the number of records raise above 100 the server raise a 502 Proxy Error. The report outputs fine in HTML. The process that hangs up the server is the conversion from html to PDF. I'm usi...
marcoslhc
2

votes
1

answer
1.2k

Views

Add 'comic sans ms' font in pdf using pisa library in django

i want to add 'comic' font in pdf file by using Pisa in django. Pisa default font is Helvetica for text, but i want more fonts in my generated pdf, like arial,comic, symbol, verdana etc. Please help!
Ahsan
18

votes
5

answer
7.5k

Views

Is there a way to generate pdf containing non-ascii symbols with pisa from django template?

I'm trying to generate a pdf from template using this snippet: def write_pdf(template_src, context_dict): template = get_template(template_src) context = Context(context_dict) html = template.render(context) result = StringIO.StringIO() pdf = pisa.pisaDocument(StringIO.StringIO(html.encode('UTF-8')...
mihailt
5

votes
5

answer
3.2k

Views

Table borders in Pisa

I'm trying to have table borders in my PDF using pisa to generate the PDF from my html page. According to the documentation, I should use CSS to display borders in my table. However this is not working out. I can see the borders on my webpage, but on the generated PDF there's absent. Is there som...
4

votes
1

answer
3.3k

Views

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 the Pisa on the code below, I get three pages that e...
ChrisGuest
5

votes
1

answer
4.8k

Views

How to send pdf as an email attachment in Django

Hi I am using the follwoing 2 functions to create and send a pdf via mail on the fly. What Am I doing wrong. (The export pdf function works properly when showing it in the browser.) The error I am getting is 'TypeError: 'ContentFile' object does not support indexing'. What I am doing wrong? Almost a...
Akash Deshpande
2

votes
2

answer
426

Views

pisa.CreatePDF hangs with huge html file

I am generating pdf using html template with python pisa.CreatePDF API, It works well with small html, but in case of huge html it takes lot of time. Is there any alternative ?
Mahesh Shitole
3

votes
1

answer
3.4k

Views

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 which works great for local media (css/images), but...
Dan Breen
4

votes
1

answer
2.5k

Views

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 { top: 10.5cm; bottom: 4cm; left: 1.2cm; right: 1.2cm; } @frame footer { top: 26cm; left: 1.2cm; right: 1.2cm; } } Sometimes the content...
Kassandra
6

votes
2

answer
5.7k

Views

Reportlab. Floating Text with two Columns

First of all, I'm new to python, reportlab, xhtml2pdf. I've already done my first pdf files with reportlab, but I ran into the following problem. I need a large text in two columns. First I create my canvas, create my story, append my large text as a paragraph to the story, create my Frame and fina...
user1878514
2

votes
2

answer
543

Views

Pylons and Pisa (xhtml2pdf): blank page in IE

I'm using pylons to serve a dynamically generated pdf document for reporting: my approach works in firefox & chrome (it displays the pdf inline if the plugin is available or otherwise downloads it) but IE (7 & 8) only show a blank page and doesn't prompt for download. IE correctly shows PDFs generat...
Utaal
2

votes
1

answer
740

Views

CssParser Error, while converting html to pdf ,PISA & Python

Im trying to convert html documents into pdf file using pisa and python. It works fine for small html code. But when you pass google.com's html data through it , or in fact any big html file , it troughs this error. here is the code that converts the html to pdf: import ho.pisa as pisa import sys im...
thecreator232
2

votes
0

answer
305

Views

xhtml2pdf: background-color does not fill frame

I have a GAE python server whom I send data from a form, and according to this data the server creates a pdf-compatible html string, converts it to pdf using pisa/xhtml2pdf and sends the pdf file to the user. The output is a graph made using divs/frames, the position/size is automatically calculated...
deltragon
4

votes
1

answer
2.1k

Views

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 = pisa.pisaDocument(StringIO.StringIO(html.encode('UTF-8')), result) if not pdf.err: return HttpRes...
Stefano Ruzza
31

votes
7

answer
19.2k

Views

django - pisa : adding images to PDF output

I'm using a standard example from the web (http://www.20seven.org/journal/2008/11/pdf-generation-with-pisa-in-django.html) to convert a django view / template into a PDF. Is there an 'easy' way to include images (either from a url or a reference on the server) in the template so they will show on th...
jduncan
7

votes
1

answer
3.7k

Views

Using Pisa to write a pdf to disk

I have pisa producing .pdfs in django in the browser fine, but what if I want to automatically write the file to disk? What I want to do is to be able to generate a .pdf version file at specified points in time and save it in a uploads directory, so there is no browser interaction. Is this possibl...
PhoebeB
2

votes
1

answer
1.4k

Views

Generating PDF using xhtml2pdf in landscape mode

How do I go about creating a 3 col landscape layout using xhtml2pdf? I tried something like this but it didn't work. Should I even be using frames in the first place? @page { size: a4 landscape; @frame left { -pdf-frame-content: left; -pdf-frame-border: 1; width: 9.9cm; text-align: left; } @frame mi...
super9
2

votes
1

answer
836

Views

How to setup a 3-column layout using pisa xhtml2pdf

I have a list of items that I want to layout in three columns. The list is pretty long (using a 3-column layout might take 5 pages). The conditions are as follows: The first page has a header that is about 200px in height and 100% in width. After the heading in the first page, the page should start...
user1408125
2

votes
1

answer
390

Views

Issue with django-pisa pdf in dhivehi language

I've generated a pdf using Django-pisa.. the PDF content is taken from database which is in the correct alignment but can't get it done right on the PDF.... I've used: filename = '/home/anoop/DjangoCodes/hello.pdf' c = ''' @font-face {font-family: code2000;src: url(dhivehi.otf.ttf);} html {font-fam...
anoop
2

votes
1

answer
851

Views

Convert arabic page using xhtml2pdf.pisa in Python

I'm trying to convert html2pdf from pisa utility. please check the code below. I'm getting error which I couldn't figure out. Traceback (most recent call last): File 'dewa.py', line 27, in html = html.encode(enc, 'replace') UnicodeDecodeError: 'ascii' codec can't decode byte 0xd9 in position 203: o...
ArunaNZ
4

votes
1

answer
2.2k

Views

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 Reportlab Toolkit and it works good but it's not what I nee...
systempuntoout
4

votes
1

answer
3k

Views

Show different footers on first and consecutive pages with pisa/xhtml2pdf

I'm having some trouble getting a footer to appear as one frame on the first page of a Pisa document, and as another frame on every other page. I have attempted to adapt the lastPage idea from here, but with no luck. Is it possible to do this? doesn't seem to be the right thing here since the docum...
Sam Kingston
2

votes
0

answer
195

Views

Pisa arabic rendering issue using xhtml2pdf and reportlab

Arabic goes wrong displayed on output pdf with the following code: template = get_template(template_src) context = Context(context_dict) html = template.render(context) result = StringIO.StringIO() pdf = pisa.pisaDocument(StringIO.StringIO( html.encode(pdf_encoding)), result, encoding=pdf_encodi...
Amir Asaad
3

votes
2

answer
2.5k

Views

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) including SVGs in the PDF export from Pisa?
Nick Sergeant
3

votes
1

answer
1.1k

Views

How to repeat a <th> 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 attribute repeat.' Their example code is: > Column 1......
Chris
2

votes
1

answer
1.4k

Views

Creating a PDF with pisa and non-ascii characters

I am attempting to create a PDF document using pisa which includes user input. The user input can be in can be in other languages. When attempting to input Chinese or Japanese the characters are displayed as black boxes. How do I get the PDF to display correctly even when I do not know what language...
Kara
1

votes
2

answer
2.8k

Views

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: pisa-3.0.33\test\test-unicode-all.html and \test-bidirectional-t...
user490616
3

votes
2

answer
3.5k

Views

pisa html2pdf convert table dont apply height to td

I use pisa xhtml2pdf to convert an html code to pdf. I have a problem! pisa did not apply some style to my table such as height and vertical-align A lot of data but after converting this html to pdf, height of table tds and vertical-align did not correct! Please help me.
happy Sun
3

votes
3

answer
1.3k

Views

django pisa - pagenumber just for two or more pages - show pagenumber of total pages

Is there a posibility to show the pagenumber with django pisa just for two or more pages? The template for showing up pagenumber looks like this: Page I think it's necessary to get the number of pages, before they are processed by pisa. Any option to use an if/else statement like this pseudo: if pa...
surfi
2

votes
2

answer
392

Views

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
sascha91

View additional questions