We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Not drawing 4th side of rectangle

Hi,
I am trying to draw rectangle over text I am able to draw it using PDFContentEditor.CreatePolyLine but the result has only 3 sides drawn and 4th side is missing.
I have attached image of result and code I am using is as below:
private static void DrawBox(PdfContentEditor editor, int page, TextSegment segment, System.Drawing.Color color)
{

        var lineInfo = new LineInfo();

        lineInfo.VerticeCoordinate = new[] {

        (float)segment.Rectangle.LLX, (float)segment.Rectangle.LLY,

        (float)segment.Rectangle.LLX, (float)segment.Rectangle.URY,

        (float)segment.Rectangle.URX, (float)segment.Rectangle.URY,

        (float)segment.Rectangle.URX, (float)segment.Rectangle.LLY

        };

        lineInfo.Visibility = true;

        lineInfo.LineColor = color;
        lineInfo.LineWidth = 1;

        editor.CreatePolyLine(lineInfo, page, new System.Drawing.Rectangle(0, 0, 0, 0), null);

    }

RectangleSideMissing.JPG (80.2 KB)

@asif.khan

Thanks for contacting support.

In order to draw rectangle around found/desired text in the PDF, please check the code snippet and sample PDF document, shared in other thread which is created by you with similar requirement. In case you face any further issue, please feel free to contact us by posting your reply in the respective thread.