[reportlab-users] overscore spacing issue
Chris Jerdonek
jerdonek at gmail.com
Fri Feb 24 12:33:27 EST 2006
On Feb 24, 2006, at 7:48 AM, Robin Becker wrote:
> OK do you have a small example where the problem occurs? If so post
> the test code.
> --
> Robin Becker
Okay, I'll start with a small issue unrelated to the e-mailing.
Running the below displays a PDF with the multiplication problem 1 x 1
arranged vertically, with a line underneath the problem. (\x60 is an
overscore symbol, and \xb4 is the multiplication symbol.)
In Mac's PDF viewer, the line is correctly right-justified with the
problem, but in Mac's Adobe Acrobat Professional 6.0.1, the line starts
underneath the 1 and extends too far over to the right.
Thanks,
--Chris
import reportlab
from reportlab.pdfgen.canvas import Canvas
from reportlab.platypus import Table, TableStyle, SimpleDocTemplate
from reportlab.platypus import Spacer, PageBreak
from reportlab.lib.units import inch
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.pdfbase import pdfmetrics
PAGE_WIDTH, PAGE_HEIGHT = letter
MARGIN = .75 * inch
TEXT_WIDTH = PAGE_WIDTH - 2 * MARGIN
def grid():
"""Return problem table."""
t = Table([ ["1\n\xb4 1\n\x60\x60"] ], 72, 72)
t.setStyle(TableStyle([
('VALIGN',(0,0),(-1,-1),'MIDDLE'),
('ALIGN',(0,0),(-1,-1),'RIGHT'),
('TOPPADDING',(0,0),(-1,-1),0),
('BOTTOMPADDING',(0,0),(-1,-1),0),
('RIGHTPADDING',(0,0),(-1,-1),36),
('FONT',(0,0),(-1,-1),'Symbol'),
('FONTSIZE',(0,0),(-1,-1),14),
('LEADING',(0,0),(-1,-1),14)]))
return t
def template(file_name):
return SimpleDocTemplate(file_name, pagesize=letter, topMargin =
MARGIN,
bottomMargin = MARGIN)
class Method:
def MakePages(self):
doc = template("test.pdf")
doc.build([grid()])
h = Method()
h.MakePages()
More information about the reportlab-users
mailing list