Draw line with arrow at the end

I’m still evaluation Aspose.Pdf for .NET for our needs. I’d like to add an arrow like the one in the attachment to a pdf page. How can I do that?

Arrow.PNG (6.2 KB)

@sporty21

Thanks for contacting support.

You can draw an arrow head line using LineAnnotation. Please check following code snippet:

Document pdfDocument = new Document();
pdfDocument.Pages.Add();
Aspose.Pdf.Rectangle rect2 = new Aspose.Pdf.Rectangle(71, 575, 100, 575);
LineAnnotation line2 = new LineAnnotation(pdfDocument.Pages[1], rect2, new Aspose.Pdf.Point(71, 575), new Aspose.Pdf.Point(500, 575))
{
 Intent = LineIntent.LineDimension,
 Color = Aspose.Pdf.Color.Black,
 EndingStyle = LineEnding.OpenArrow,
 StartingStyle = LineEnding.OpenArrow
};
Border border2 = new Border(line2);
border2.Width = 2;
line2.Border = border2;
pdfDocument.Pages[1].Annotations.Add(line2);
pdfDocument.Save(dataDir + "lineannotaiton.pdf");

lineannotaiton.pdf (1.5 KB)

In case of any further assistance, please feel free to let us know.

@asad.ali

Thank you for you answer. The start of the arrow in the attached pdf is slightly intendend and it doesn’t really look nice. Is there a way to have all “in one point”?

@sporty21

Thanks for writing back.

Please note that the Aspose.PDF API mimics the behavior of Adobe Acrobat and if you add similar line (with arrowheads) using Adobe Reader, you will notice the similarity. However, we have logged an investigation ticket as PDFNET-45543 in our issue tracking system to investigate whether it is feasible to make arrow heads sharper or not. We will surely let you know in case some progress is made towards ticket resolution. Please spare us little time.

We are sorry for the inconvenience.