[reportlab-users] Issues related to setting parameters of graphs, lines, and rectangles, and they are not printing correctly

Tim Roberts timr at probo.com
Wed Nov 28 14:55:06 EST 2012


J. R. Carroll wrote:

>

> However, I am still having the problem with the pattern-esque prints

> for line widths in my grid/graph that are smaller than a unit-size of

> 1 (line width of 0 just makes the pattern worse). I have strong

> impressions it's not the printer because:

>

> 1. I've tried other printers and got the same results

> 2. I've printed another PDF that has a similar graph, and the lines

> are 1 dot thick (when I look at the print under a microscope)

> 3. I can turn up the printer settings (DPI) and get the grid to

> print fully.

>

> Do you, or does anyone else, know of a way I can make the grid/graph

> that I want using the ReportLab library, rather than my homebrewed way?


Can you send me a code sample and/or a PDF that demonstrates the problem?



> (currently, I am telling it to paint to a drawing, then rendering the

> drawing to the canvas - but more importantly I am drawing each line

> myself - draws all the vertical minor/major lines, then draws all the

> horizontal minor and major lines, then paints it to the canvas - my

> coworkers are positive that ReportLab has already solved this problem).


This looks OK for me on my 600-dpi printer. What do you see?

<code>
import os
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import LETTER
from reportlab.lib.units import inch, mm

DEBUG=1

canv = canvas.Canvas( 'stripchart.pdf', pagesize=LETTER )
canv.setPageCompression( 0 )
canv.setLineJoin(1)
canv.setLineCap(1)
canv.setLineWidth(0)
canv.setStrokeColor( (1.0, 0.8, 0.8) )

# Draw a few inches in the middle.

X0 = 3*inch
Y0 = 8*inch
X1 = X0 + 41*mm
Y1 = Y0 + 41*mm

for i in range(41):
if i % 5 == 0:
canv.setLineWidth( 0.5 )
else:
canv.setLineWidth( 0 )
canv.line( X0, Y0+i*mm, X0+40*mm, Y0+i*mm )
canv.line( X0+i*mm, Y0, X0+i*mm, Y0+40*mm )
canv.showPage()
canv.save()

if DEBUG:
os.system('start stripchart.pdf')
</code>


--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list