I just installed py36-reportlab from AppCafe, but it’s nowhere to be found. It shows as installed in the installed tab in SysAdm, but I don’t know how to run it. It didn’t make an icon or anything. I rebooted my computer and nothing showed up after that either. I tried running reportlab in a terminal, I also typed rptlab, and nothing. Does anyone know how to open this program?
appcafe, installed, select py36-reportlab. You should see 3 tabs, select the last one that looks like a list. It should have build options, dependencies, files, shared libraries.
Expand Files. That shows you what it installed.
Now the description says “library to create pdf documents using the python language”; I don’t know if it has an executable or just libraries. Look for something in /usr/local/bin.
Nothing (that I can identify) in /usr/local/bin… It’s not very clear… I think it’s supposed to be a report writing Canvas, that I was going to use in conjunction with py36-PollyReports, but I can’t find a way to open either one.
they both are just python libraries. quick look at their doc suggests one need to write a python script to use them.
As noted above, PollyReports expects a Reportlab-like canvas interface. The
module has been kept as clean as possible, so that, though I don’t actually
recommend it, it would not be insane to say
from PollyReports import *
Importing only what you expect to use is still a better idea, of course.
It seems you guys are right. There is no executable and that is just python libraries. I used to use JasperReports in conjunction with iReport, but JasperReports stopped supporting FreeBSD and it seems to have been pulled from the FreeBSD pkg repo. iReport is still in there, but it’s useless without JasperReports. I was looking for an easy alternative but I don’t think there is any at this time.
After reading a little bit, it seems that I have to “Install ReportLab” in my python environment, and then write a pythons script that imports what I need for that specific report, I have to import page sizes, fonts, etc… So that I can make simple reports…
Looks like I will have to learn python, but first I need to figure out how to even install ReportLab on my python environment… Whatever that means.
Thank you for your time guys.
you probably already have by installing the py36-reportlab package, but you’ve done it system-wide (unless you want the commercial version). Now you can create a small python script:
# hello_rlab.py from reportlab.pdfgen import canvas from reportlab.lib.units import cm c = canvas.Canvas("hello.pdf") c.drawString(9*cm, 22*cm, "Hello World!") c.showPage() c.save()
then run it with
python3.6 hello_rlab.py. This example outputs ‘hello.pdf’ file in the current directory.
For more confined experiments, should you decide to get more recent version of the library, which is not in the packages yet, you can create so called python virtual environment, which is mostly just a copy of a system python, where you can install/delete python packages w/out touching the original (think of it as a jail for python).
Same stuff applies to py36-PollyReports.
# sample02.py from reportlab.pdfgen.canvas import Canvas from PollyReports import * from testdata import data rpt = Report(data) rpt.detailband = Band([ Element((36, 0), ("Helvetica", 11), key = "name"), Element((400, 0), ("Helvetica", 11), key = "amount", align = "right"), ]) canvas = Canvas("sample02.pdf", (72*11, 72*8.5)) rpt.generate(canvas) canvas.save()