activePDF underline fieldinfo in .net

144 Views Asked by At

I am using Adobe Acrobat Standard DC 2015 Release (Classic), Version 2015.006.3028 and Visual Studio 2013 MVC5 with VB.net. This is an office so I can't just upgrade my versions.

I have an issue with the fact that activePDF does not allow underline in their text input fields. I have found a workaround that while not perfect was good enough for my document.

If anyone knows of a different way to do this I would be very grateful.

I have a list of strings that need to display in no particular order and the number of lines can vary. But some of the lines need to be underlined, which I have not been able to do using the FieldInfo properties in .net. I don't know which particular text input box the string will displayed in on the document until I get to the .net code. Not that the text input box on the document itself has an underline property anyway.

What I have found is that you can add a hyperlink box around hyperlink text. Why a box and not just an underline I don't know. The text in this instance will not be an actual hyperlink, but my users just display the document and print it so that is fine. I just need a line.

I created a hyperlink box that is only 1 unit tall, so it makes a double underline. And it is the width of the field, not the text. I couldn't find any property to give me the textWidth, only the fieldWidth. I tried making it print the line on the same line to make a really thick line but it won't do that, so a double line it is.

I've created my APToolkitNET.Toolkit object (objPDF) and now I'm ready to begin my SetFormFieldData for my input fields.

objPDF.SetFormFieldData("txtTestItem", "This is a test.", -998)
Dim thisField As FieldInfo = objPDF.FieldInfo("txtTestItem", 1)
objPDF.AddHyperlink(thisField.PageNumber, thisField.Left, thisField.Bottom, _
    (thisField.Left + thisField.Width), (thisField.Bottom + 1), "", 0)

Finished out the rest of my objPDF and Response items and now I get this:

Image of Form

More info about the hyperlink object can be found here: http://www.activepdf.com/AltDownloads/Documentation/TK2011/AddHyperlink.html

I've been searching for a better solution for days but it doesn't look like ActivePDF has a lot of stuff out there made by users. Everything links back to their own website. So hopefully someone needed this like I did and it actually helps them!

1

There are 1 best solutions below

0
On BEST ANSWER

Instead of using a hyperlink to draw the line you could also do it with the MoveTo and DrawTo functions. As you already have the coordinates to use when adding the hyperlink you can use those to determine where to draw the line.

LineWidth is also available to control the width of the line.