private static void AddRectangle(Aspose.Pdf.Page page, float x, float y, float width, float height, Aspose.Pdf.Color color, int zindex)
{
// Create graph object with dimensions same as specified for Rectangle object
Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(width, height);
// Can we change the position of graph instance
graph.IsChangePosition = false;
// Set Left coordinate position for Graph instance
graph.Left = x;
// Set Top coordinate position for Graph object
graph.Top = y;
// Add a rectangle inside the "graph"
Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(0, 0, width, height);
// Set rectangle fill color
rect.GraphInfo.FillColor = color;
// Color of graph object
rect.GraphInfo.Color = color;
// Add rectangle to shapes collection of graph instance
graph.Shapes.Add(rect);
// Set Z-Index for rectangle object
graph.ZIndex = zindex;
// Add graph to paragraphs collection of page object
page.Paragraphs.Add(graph);
}
// ExEnd:AddRectangle