I'm using PDFSharp 1.30 GDI+. I'm importing and drawing a truss shape into a document. The trick is that in my coordinate system, the truss's bottom left corner rests at 0,0 and fills in Quadrant I from there. Rendering it in PDFSharp seemed pretty straightforward at first glance. Just loop through the line segments, running this code:
Code:
gfx.DrawLine(XPens.PowderBlue, faceLine.BasePoint.X.Inches, faceLine.BasePoint.Y.Inches, faceLine.EndPoint.X.Inches, faceLine.EndPoint.Y.Inches);
However, since the origin in PDFSharp starts at the top left, my truss shape renders upside down. I can halfway solve this by moving the origin to the bottom right with this code:
Code:
gfx.RotateTransform(180);
gfx.TranslateTransform(-612, -792); // Assumes 8.5 inch x 11 inch at 72 points/inch
Now my truss renders right side up, but because of the rotate transform, any text I add is upside down. This might be solved by a
Code:
gfx.Save()
and
Code:
gfx.Restore()
, but the text I need to add needs to be in very specific places relative to the truss shape I've drawn (like labeling the members in the attachment. I do that by attempting to add the text at the same time as drawing the lines, but then it is upside down.
Attachment:
File comment: Example of my problem
Capture.PNG [ 98.46 KiB | Viewed 5822 times ]
The simplest solution seems to be if I could move the origin to the bottom left corner. However this is
not yet implemented. What's the best approach to this problem?