How to add rectangle with no border in graph?

TextFragment fragment = new TextFragment(“Test”);
fragment.TextState.DrawTextRectangleBorder = false;

Aspose.Pdf.Drawing.Rectangle rectangle = new Aspose.Pdf.Drawing.Rectangle(72f, 72f, (float)fragment.Rectangle.Width, (float)fragment.Rectangle.Height);
rectangle.Text = fragment;
rectangle.Text.TextState.DrawTextRectangleBorder = false;

graph.Shapes.Add(rectangle);

I has set the DrawTextRectangleBorder to false, but the border still appears.

@Junyoung

Thank you for contacting support.

Please elaborate if you want to add a rectangle on a PDF page, or if you want to draw it around the text. If you want to add the rectangle around text but without borders, then you can set Color of Graph to White or Transparent as in the line of code below:

rectangle.GraphInfo.Color = Aspose.Pdf.Color.Transparent;

In case your requirements are not fulfilled, please share a PDF file as expected output so that we may investigate further to help you out.