reportlab

reportlab issue with line breaks using XPreformatted - additionall question mark printed..

Hi, I'm using XPreformatted to print some preformated text and I have an issue with the line breaks. The line breaks are correctly translated but additionaly I get a "question mark" at the end of each line. This is my output: first line? second line? some more text I'm using django with mysql and the database field is a simple varc...

How do I find the baseline of a line of text in Reportlab?

How do I find the baseline for a line of text in Reportlab so I can align other elements on the page with the baseline of the text? I am using canvas.drawString() for these elements. ...

Django and Reportlab Question

Hello, I have written this small Django view to return pdf. @login_required def code_view(request,myid): try: deal = Deal.objects.get(id=myid) except: raise Http404 header = deal.header code = deal.code response = HttpResponse(mimetype='application/pdf') response['Content-Disposition'] = 'attachm...

python reportlab - registerFont - django - font not available after some time

Hi, I'm wondering what is the best time to register a font for use in reportlab. I added the following line into my settings.py: pdfmetrics.registerFont(TTFont('Calibri', FONT_DIR + '/fonts/Calibri.ttf')) After this call the font is available for pdf generation. But it occurs that after a few days the font is not available anymore an...

Adding a font for use in ReportLab

I'm trying to add a font to the python ReportLab so that I can use it for a function. The function is using canvas.Canvas to draw a bunch of text in a PDF, nothing complicated, but I need to add a fixed width font for layout issues. When I tried to register a font using what little info I could find, that seemed to work. But when I tr...

Adding text over existing PDFs using reportlab

I'm interested in filling out existing PDF forms programatically. All I really need to do is pull information from user input and then place the appropriate text over an existing PDF in the appropriate locations. I can already do this with reportlab by feeding the same sheet of paper into a printer, twice, but this just really rubs me th...

Dynamic Spacer in ReportLab

I'm automatically generating a PDF-file with Platypus that has dynamic content. This means that it might happen that the length of the text content (which is directly at the bottom of the pdf-file) may vary. However, it might happen that a page break is done in cases where the content is too long. This is because i use a "static" space...

Is my approach correct to replicate this form with Reportlab?

I need to generate the form seen here using Python/reportlab. http://www.flickr.com/photos/49740282@N06/4563137758/sizes/o/ I am attempting to do this by creating a custom flowable for the header at the top (with the boxes drawn) and then having a table flowable for the jewelry table below. What shows as the JEWELRY table for this exa...

Dynamically generated PDF files working in most readers except Adobe Reader

I'm trying to dynamically generate PDFs from user input, where I basically print the user input and overlay it on an existing PDF that I did not create. It works, with one major exception. Adobe Reader doesn't read it properly, on Windows or on Linux. QuickOffice on my phone doesn't read it either. So I thought I'd trace the path of me ...

Reportlab 'LayoutError' handling and debugging.

I have been working with some complex PDF outputs with reportlab. These are generally fine but there are some cases still where I get LayoutErrors - these are usually because Flowables are too big at some point. It's proving o be pretty hard to debug these as I don't often have more information than something like this; Flowable <Table...

Python - Reportlab: Error using custom font

Im using the reportlab framework for creating pdf's. I'm also using a custom font in my pdf's called '3of9'. Now, sometimes I'm getting the following error: IOError: Cannot open resource "/usr/lib/python2.6/site-packages/reportlab/fonts/LeERC___.AFM", while looking for faceName='3of9' This doesn't happens everytime, but too often. And ...

CMYK overprinting (colour-separated PDF output) with Reportlab

is it possible to use CMYK overprinting without using the CMYKColorSep class, which always generates a new seperate color in the printer settings, i just want to use overprinting with the standard 4 CMYK inks (colour-separated PDF output, as stated in the 2.4 changelog) here my example code (reportlab 2.4 needed): from reportlab.graphi...

Python Reportlab RML. How to split table row on 2 pages.

I'm wondering if there is some functionality to split table row on 2 and more pages. Cause some information in row can be too long for one page. And if one row longer then page size then it's cause an exception. ...

Referencing further pages with ReportLab

I'm using ReportLab to create long questionnaires and I need to create text like If you do not have allergies, proceed to page 168 Does ReportLab present some feature that can help me with this referencing task? I understand that this problem probably needs a two-pass algorithm. In the first pass, the pages' numbers are found. T...

PDF image in PDF document using ReportLab (Python)

Hi there, I saved some plots from matplotlib into a pdf format because it seems to offer a better quality. How do I include the PDF image into a PDF document using ReportLab? The convenience method Image(filepath) does not work for this format. Thank you. ...

footer on lastpage using reportlab

Hi, Can anyone tell me how to put footer only on last page using reportlab? I am able to put footer on every page, but i want it only on last page. Below is my code, def beforeDrawPage(self, canv, doc): "Decorate the page with an asymetric design" #canv.setFillColor(colors.orange) productpath = os.path.dirname(config.__fil...

instantiate python class from class available as string , only in memory!

Hi, I'm using Reportlab to create PDFs. I'm creating two PDFs which I want to merge after I created them. Reportlab provides a way to save a pycanvas (source) (which is basically my pdf file in memory) as a python file, and calling the method doIt(filename) on that python file, will recreate the pdf file. This is great, since you can co...

Add page break to Reportlab Canvas object.

I need to generate a 2 pages pdf report. Pages are completely independent. tried using: mycanvas.drawString(x, y, "Printing on Page 1") mycanvas._pageNumer = 2 mycanvas.drawString(x, y, "Printing on Page 2") and: mycanvas.drawString(x, y, "Printing on Page 1") P = PageBreak() P.drawOn(mycanvas, 0, 1000) mycanvas.drawString(x, y, "Pri...

Appengine - Reportlab PDF

Hello, I'm using Google appengine and want to generate a PDF with reportlab. The application works well and can generate PDF's like 'Hello World' and little else. But what I want is to fetch data from a form with the data that the user entered and generate PDF dynamically. Anyone can share a piece of code? I would be grateful. ...

confused using reportlab to get RGB data from binary output of jpeg image reader?

for the reportlab library there is a module utils.py, and within this module a class class ImageReader(object): I was expecting to use this class to get RGB style data of integers between 0 and 255 but instead my code returns the following (1718461541,) for each print line below import struct filename = "pakistan.jpg" imageObj = u...