Fonts / positioning different on Windows vs Linux
Mike Driscoll <[email protected]>
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <CAO4gEAs79K5tbfcNZQrviv+w-WDreGBHtB1SuhB0VN+xLyoMSQ@mail.gmail.com> |
Hi, I was wondering why the standard font is different on Linux versus Windows. Also, I noticed that the actual positioning of the text / elements are slightly different. The latter may be partially a function of the font difference, although I'm not sure of that. Anyway, I created a simple example where I have a barcode and an address underneath it. You'll notice that the first line of the address is slightly closer to the barcode when the code is run on Linux versus when it's run on Windows. This might not seem like a big deal, but I discovered that it matters when you are trying to position MICR marks on a check...I would get it working on one OS to find out it was broken on another. And I've had code where it will look great on Windows, then when I run it on Linux, the first line of the address is buried in the barcode. I am testing on CentOS and Windows 7. ------------------- Mike Driscoll Blog: http://blog.pythonlibrary.org
test_linux.pdf
(application/pdf, 2.5 KB) - not displayed
pdf_test.py
(text/x-python, 833 B)
from reportlab.lib.pagesizes import letter
from reportlab.graphics.barcode import code39
from reportlab.platypus import Paragraph
from reportlab.pdfgen import canvas
from reportlab.lib.styles import getSampleStyleSheet
styles = getSampleStyleSheet()
width, height = letter
c = canvas.Canvas("test.pdf", pagesize=letter)
barcode = code39.Standard39("123456789",
barHeight=20.2,
checksum=0)
barcode.drawOn(c, 53, 642)
ptext = """
<font size=8>
%s<br/>
%s<br/>
%s<br/>
%s
</font>
""" % ("Jimmy Dean",
"Pork Paddy Ave.",
"Suite 202",
"Paddington, PA, 00000")
p = Paragraph(ptext, style=styles["Normal"])
p.wrapOn(c, width, height)
p.drawOn(c, 70, 593)
c.save()
print "fin"
test_win.pdf
(application/pdf, 2.3 KB) - not displayed