Free Support Forum -

Remove a horizontal line from page

Dear Support,

i have an application that adds hyperlinks to a pdf file using Aspose.pdf. The technique I am using is to find a TextFragment using the TextFragmentAbsorber, I add a link annotation over the TextFragment Rectangle, change the foreground color of the TextFragment to blue and set the TextState.Underline property to true. This works well.

I now have a need for an application that can remove one of these hyperlinks I have previously created. I have most of it working. I find the TextFragment, find the link annotation, delete the link annotation and set the text color to black. The problem I am having is removing the underline. In this application, when I get the TextFragment, its Textstate.Underline property is false, not true. So, setting it to false does nothing. So, what I need is the ability to find a horizontal line that is immediately below my TextFragment and remove it. I have not been able to find anything in your documentation or on the forums for doing this. Is it possible?


Thank you for contacting support.

Would you please share a narrowed down sample application along with respective PDF files so that we may try to reproduce and investigate it in our environment. Before sharing requested data please ensure using Aspose.PDF for .NET 18.10 in your environment.

Here you go. This console app has everything you need. There is a pdf file called testdoc.pdf. The program will open that file, generate an underline and save the file to testdoc_out1.pdf. It will then open testdoc_out1.pdf and attempt to remove the underline from the TextFragment and save the file to (205.5 KB)
. But, as you will see, the TextFragment does not show being underlined.


Thank you for sharing requested data.

We have been able to reproduce the issue in our environment. A ticket with ID PDFNET-45535 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hello Support,

I thank you for logging this issue. But I still have my initial question. Is there any way using your library to find this horizontal line in the content and remove it? Under the covers I am sure there is a MoveTo and LineTo being performed. I would like to delete that. Can I do that with your library? If so, can you give me a brief example on how to do it?



We are afraid that a horizontal line may not be detected by the API. We will let you know as soon as logged ticket will be resolved. We appreciate your patience and comprehension in this regard.