Line with border DynaPDFMBS

Anyone know how to make lines with a border, like this, but at 45 degrees or other angle, in a PDF using DynaPDFMBS?


Well, you can draw this rectangle already, right?

So you only need to use RotateCoords function to rotate the world before drawing it.


Dim pdf As New MyDynapdfMBS
dim d as new date
dim f as FolderItem = SpecialFolder.Desktop.Child("Create PDF.pdf")

pdf.SetLicenseKey "Starter" // For this example you can use a Starter, Lite, Pro or Enterprise License

call pdf.CreateNewPDF f
call pdf.SetDocInfo pdf.kdiSubject, "My first Xojo output"
call pdf.SetDocInfo pdf.kdiProducer, "Xojo test application"
call pdf.SetDocInfo pdf.kdiTitle, "My first Xojo output"

call pdf.Append

call pdf.SaveGraphicState
// move to place where top left point is
Call pdf.TranslateCoords(100, 700)

// rotate in place by 45° to up  or -45 for down
Call pdf.RotateCoords(-45, 0,0)

// draw a rectangle so we see where we are
call pdf.SetFillColor(pdf.RGB(255, 200, 200)) // light red
Call pdf.Rectangle(0, 0, 100, -100, pdf.kfmFill)

// and a little black dot
call pdf.SetFillColor(0) // black
call pdf.Rectangle(0, 0, 2, -2, pdf.kfmFill)

// and finally some text
call pdf.SetTextRect 0, 0, 300, 200
call pdf.SetFont "Times", pdf.kfsItalic, 40.0, true, pdf.kcpUnicode
call pdf.WriteFText pdf.ktaCenter, "My first Xojo output!"
call pdf.RestoreGraphicState // don't forget to restore

call pdf.EndPage

call pdf.CloseFile



gives this output

Yeuch. :slight_smile:

Im really looking for ‘draw from here to there’ rather than trying to work out where ‘here and there’ would be after I rotate the paper.

Rotate Coords got me there in the end. Because I needed to get several lines to cross at the same point, there was much trial and error.
And I had to keep saving state, rotating, placing, and restoring state.
Anyone else doing this - also note that you will need to set the page back to topdown co-ordinates afterwards for some reason.
But I got there.