Hello all, I’ve looked through the documentation and have tried different things, but I’m still unable to remove the borders from form fields in an existing pdf. The following code successfully sets the value of txtName but the border remains:
using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(pdfFile))
{
TextBoxField txtName = pdfDocument.Form[“txtName”] as TextBoxField;
txtName.Value = “name value from aspose”;
txtName.Border.Width = 0;
{
Tried setting it to an empty Border() object and a few other things, with no effect.
Not sure what else to try. Grateful for any help -
Hi there,
Thanks for your inquiry. I am afraid you cannot remove the border but set its color to transparent. Please use Characteristics property to set border color as following. Hopefully it will help you to accomplish the task.
txtName.Characteristics.Border = System.Drawing.Color.Transparent;
Please feel free to contact us for any further assistance.
Best Regards,
Thanks for the reply Tilal. Unfortunately, System.Drawing.Color.Transparent didn’t work, but System.Drawing.Color.FromName(“Transparent”) did. I don’t know why, but I can now continue with my evaluation.
Jeff
Hi Jeff,
We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.
Correction: System.Drawing.Color.Transparent works, but if I set txtName.ReadOnly to true, the border comes back. Do you know of any way to keep the border transparent when a form field .ReadOnly = true?
Thanks -
Hi Jeff,