PDFGraphics drawline rounded

A pdfdocument made with web 2020r2 draws lines with rounded tips. How can I prevent this? I am using PDFDocument.Graphics.Drawline(x1,y1,x2,y2) with pensize larger than 1. In the previous version (2020r1) the lines had ■■■■ ends.

You have to set the LineCap via PDFGraphics.LineCap.

I get this error:
Type “PDF.PDFGraphics” has no member named “linecap”

Pdfdocument.graphics.Linecap

1 Like

PDFDocument.Graphics has no member called Linecap. It is shown in Documentation in Graphics but in the IDE it throws an error. Even not available in autocomplete. Also Documentation states: Affects only lines drawn when using DrawPath, GraphicsPath and Object2D. Does not seems to affect DrawLine

Minimum Version Xojo 2020r2! Works only on Desktop. So you found a bug.

Var pdf As New PDFDocument
Var g As Graphics = pdf.Graphics

g.LineCap = Graphics.LineCapTypes.Square // not working on Web 2.0 - It's a bug.
g.PenSize = 3
g.DrawLine(10, 10, 300, 10)

pdf.Save(SpecialFolder.Desktop.Child("Line.pdf"))
1 Like

Are you sure that works for a Web project?

I’m learning about Graphics, it looks like Web uses WebGraphics but there is no pdf.WebGraphics

Edit:
It looks like Graphics in Web 2.0 there is no LineCap
WebGraphics there is LineCap
There is no pdf.WebGraphics but pdf.Graphics, so I can’t find a way to use WebGraphics and LineCap on Web for PDF.

1 Like

Yeah you’re right. This works for Desktop, but not in Web 2.0 Projects. Bug!

The PDFDocument has a .Graphics property as PDFGraphics the PDFDocument class is available on web 2.0 too

feedback://showreport?report_id=63058

1 Like