Add annotation in PDF using C# .NET | Aspose.PDF | Border is shown without specifying it

Hi,

I have a question for you. I expect not to see annotation’s border when adding SquareAnnotation to pdf document. The reason for this is because my squareAnnotation.Border is null and squareAnnotation.Characteristics.Border is empty. So relying on this properties I expect not to get a border. But my output pdf still contains border.

Code sample is given below:

Document pdf = new Document(@"C:\input.pdf");
Aspose.Pdf.Rectangle rectangle = new Aspose.Pdf.Rectangle(100, 500, 200, 600);
SquareAnnotation squareAnnotation = new SquareAnnotation(pdf.Pages[1], rectangle);
pdf.Pages[1].Annotations.Add(squareAnnotation);

Console.WriteLine("Is border null? - {0}", squareAnnotation.Border == null);
Console.WriteLine("Is characteristics border null? - {0}", squareAnnotation.Characteristics.Border.IsEmpty);

pdf.Save(@"C:\result.pdf");

Is this problem problem is on your side? Or if I missunderstood your API, how can I add an annotation without drawing it’s border?

input.zip (2.4 KB)
image.png (9.8 KB)

Thanks,
Alex

@AlexBilakovskyi

We were unable to see any border in the result.pdf that you shared when we opened it in Adobe Reader. Could you please share the screenshot of annotation in PDF with border so that we can further proceed to assist you accordingly.

@asad.ali

Oh, I am used to open pdf files with browser. Here are some screenshots of result pdf opened in edge and chrome browsers. I guess file view should be the same whatever I use to open it?

pdfInChrome.png (41.9 KB)
pdfInEdge.png (46.4 KB)

@AlexBilakovskyi

Please note that it depends upon the viewer settings or behavior that how it will show certain elements inside the PDF documents. Aspose.PDF mimics the behavior of Adobe Reader and follows its standards. If annotation border is showing in Chrome or Edge, it is their own settings and behavior and has nothing to do with the API. In case there is some issue in the PDF while viewing it in Adobe Reader, please feel free to let us know.

@asad.ali

Thank you for the explanation!