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

Free Support Forum - aspose.com

Draw line on existing PDF

Attempting to draw a line on a PDF.

I seem to only have access to the bottom right section of the PDF.

The Graph is defined as the Page Width by the Page Height.

But when I use the following code to draw a line from the bottom left corner to the top right corner, the bottom start about a third over from the left side of the page and the line only extends about 2/3 up the page.

Any ideas?

        //Create an array containing the (X,Y) values of 4 control points
        //required to position a curve
        float[] posArr = new float[] { (float)page.Rect.LLX, 0, (float)page.PageInfo.Width, (float)page.Rect.URY };
        // create a line with coordinates defined in array
        Aspose.Pdf.Drawing.Line line1 = new Aspose.Pdf.Drawing.Line(posArr);
        Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph((float)page.PageInfo.Width, (float)page.PageInfo.Height);
        graph.Margin.Left = 0;
        graph.Margin.Right = 0;
        graph.Margin.Top = 0;
        graph.Margin.Bottom = 0;


Thanks for contacting support.

Can you please share complete working sample code along with source file and desired result so that we may further investigate to help you out.

The issue was Page margins.


It is good to know that you were able to find the issue. Please keep using our API and in case you face any issue, please feel free to let us know.