PdfContentByte cb = writer.DirectContent; cb.MoveTo(100, 100); cb.LineTo(200, 100); cb.ClosePathStroke();
PdfContentByte cb = writer.DirectContent; cb.Rectangle(100, 100, 100, 50); cb.ClosePathStroke();In this example, a rectangle is drawn using the Rectangle method, which takes the x and y coordinates of the bottom-left corner, as well as the width and height of the rectangle. The path is then closed and stroke using ClosePathStroke method. Both examples use the iTextSharp library package.