[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 12:50:31 EST 2012


J. R. Carroll wrote:

> *First problem:*

>

> ///My problem:/ On the screen, it looks great! When I send it to a

> printer (600 dpi, "standard" settings) it prints a pattern of lines

> (some lines are printed, and others are not) - some have suggested

> that this is the printer trying to "anti-alias" my lines because I

> have set my line widths to be .1 to .8 which is some small fraction of

> 1/72dpi (a line width of 1 is too thick for what I am doing). How can

> I fix this problem? My goal is to get minor grid lines spaced at 1 mm

> apart, and every 5 mm a major grid line, with a heavier weight

> (thickness? alpha?) is drawn. I currently have the solution scripted

> but again it only works on the screen, not at the printer.


The advice on the forum is correct -- if you want a one-pixel line,
regardless of output resolution, use a stroke width of 0. It's likely
that what you're seeing here is antialiasing caused by your Acrobat
reader stretching or shrinking your page to fit the printer boundaries.
That kind of thing is particularly bad with non-Adobe Acrobat clones.

Are you using and transforms or scaling? That adds to the problem.

That's one of the things that is easy to forget with PDFs. ReportLab
isn't actually rendering those lines. ReportLab is just writing a
command into the PDF file that says "stroke width is 0.12, now draw a
line from A to B". It's entirely up to the PDF reader or the PostScript
interpreter in the printer to decide how to turn that into pixels. Not
all interpreters agree.



> *Second problem:*

>

> I have drawn rectangles (as borders to my graphs), but the

> stroke-width is too thick of the rectangle. I didn't see anything in

> the documentation that allows me to set the stroke-width of a rect -

> any advice here? Did I miss it in the manual? (using canvas.Rect())


Rectangle borders are drawn with the "stroke" and filled with the
"fill". Set the stroke width before you call Rect, just like when you
drew lines.



> If you need additional information or context, I'll do my best to

> provide but like all corporate projects in R&D it's pretty hush-hush

> (so I apologize if you feel I have omitted some valuable information).

> What I can say is that the graph I am trying to make is for ECG strip

> charts (the link above in problem#1 has examples of what I am talking

> about).


Surely there is nothing proprietary about generating a strip chart...

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20121128/e43a8aa2/attachment.html>


More information about the reportlab-users mailing list