diff --git a/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs b/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs index 6276a8d5..5a88bcd9 100644 --- a/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs +++ b/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs @@ -57,9 +57,13 @@ public void Run(IOperationContext operationContext) { var lowerLeft = new PdfPoint(LowerLeftX, LowerLeftY); + var upperRight = new PdfPoint(LowerLeftX + Width, LowerLeftY + Height); + operationContext.BeginSubpath(); var lowerLeftTransform = operationContext.CurrentTransformationMatrix.Transform(lowerLeft); - operationContext.CurrentPath.Rectangle(lowerLeftTransform.X, lowerLeftTransform.Y, (double)Width, (double)Height); + var upperRightTransform = operationContext.CurrentTransformationMatrix.Transform(upperRight); + + operationContext.CurrentPath.Rectangle(lowerLeftTransform.X, lowerLeftTransform.Y, upperRightTransform.X - lowerLeftTransform.X, upperRightTransform.Y - lowerLeftTransform.Y); } /// @@ -83,4 +87,4 @@ return $"{LowerLeftX} {LowerLeftY} {Width} {Height} {Symbol}"; } } -} \ No newline at end of file +}