[reportlab-users] Shape + Stroke problem

khalid y kernity at gmail.com
Thu Jun 7 09:08:00 EDT 2012


Arf strange feature why just not add a Path.stroke= [true|false] and set
default to true.

Excellent it's better than set colors to transparent ;-)

Khalid




2012/6/7 Robin Becker <robin at reportlab.com>


> Andy claims it is a deliberate feature that strokes with zero width appear

> in postscript/pdf. He says the intent was to implement some drawing

> convention eg a hairline.

>

> Anyhow you can eliminate by setting the strokeColor to None eg

>

>

> #coding=utf-8

> from reportlab.pdfgen.canvas import Canvas

> from reportlab.graphics import shapes

> from reportlab.graphics import renderPDF

> from reportlab.lib import colors

>

> output = "output.pdf"

> width = 400

> height = 400

> canvas = Canvas(output, pagesize=(width, height))

> d = shapes.Drawing(width, height)

>

> p = shapes.Path(strokeColor=None,**fillColor=colors.red)

>

> p.moveTo(0, 0)

> p.lineTo(100, 100)

> p.lineTo(20, 100)

> p.closePath()

>

> # Even if I have set the strokeWidth to 0, the stroke is always present

> but thiner than 1...

> p.strokeWidth = 0

> d.add(p)

> renderPDF.draw(d, canvas, 0, 0)

> canvas.showPage()

> canvas.save()

>

>

> On 07/06/2012 13:18, khalid y wrote:

>

>> Hi,

>>

>> I'm using reporlab2.5 to draw some graphics and I'm using shapes for that

>> but I can not disable stroke ...

>>

>> Here is my code :

>>

>> #coding=utf-8

>> from reportlab.pdfgen.canvas import Canvas

>> from reportlab.graphics import shapes

>> from reportlab.graphics import renderPDF

>> from reportlab.lib import colors

>>

>> if __name__=='__main__':

>> output = "output.pdf"

>> width = 400

>> height = 400

>> canvas = Canvas(output, pagesize=(width, height))

>> d = shapes.Drawing(width, height)

>>

>> p = shapes.Path()

>> p.moveTo(0, 0)

>> p.lineTo(100, 100)

>> p.lineTo(20, 100)

>> p.lineTo(0, 0)

>> # Even if I have set the strokeWidth to 0, the stroke is always present

>> but thiner than 1...

>> p.strokeWidth = 0

>> d.add(p)

>> renderPDF.draw(d, canvas, 0, 0)

>> canvas.showPage()

>> canvas.save()

>>

>>

>> Cheers,

>>

>> Thanks

>>

>> Khalid

>>

>>

>>

>>

>> ______________________________**_________________

>> reportlab-users mailing list

>> reportlab-users at lists2.**reportlab.com<reportlab-users at lists2.reportlab.com>

>> http://two.pairlist.net/**mailman/listinfo/reportlab-**users<http://two.pairlist.net/mailman/listinfo/reportlab-users>

>>

>

>

> --

> Robin Becker

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20120607/87d21651/attachment-0001.htm>


More information about the reportlab-users mailing list