I'm using Visualstudio2022 Dark theme on my program. When I load a fillable PDF to the PDF viewer, the back color of the form fields turns to black when I click on them.
I tried changing the annotations color and the text color of the form fields, but nothing works.
How do I change the back color from black to white of the form fields on a fillable PDF?
4 Answers, 1 is accepted
Hello Hon,
Thank you for the provided file. I was able to reproduce the described behavior. The input textbox is represented by a RadTextBoxControlElement. You can get this element on a mouse click and change its ForeColor property. Here is how you can do that:
public partial class Form1 : RadForm
{
public Form1()
{
InitializeComponent();
this.radPdfViewer1.LoadDocument("../../example.pdf");
this.radPdfViewer1.MouseClick += RadPdfViewer1_MouseClick;
}
private void RadPdfViewer1_MouseClick(object sender, MouseEventArgs e)
{
var textBoxControlElement = GetTextBoxControlElement(this.radPdfViewer1);
if (textBoxControlElement != null)
{
if (textBoxControlElement.ForeColor != Color.White)
{
textBoxControlElement.ForeColor = Color.White;
}
}
}
private RadTextBoxControlElement GetTextBoxControlElement(MyPDFViewer myPDFViewer)
{
RadElement editor = null;
foreach (RadFixedPageElement visualPage in myPDFViewer.PdfViewerElement.ViewElement.Children)
{
if (visualPage.Children.Count >= 1)
{
editor = visualPage.Children.FirstOrDefault();
}
}
return editor as RadTextBoxControlElement;
}
}
Here is the result:
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Hello, Hon,
Thank you for the provided picture. However, concerning the picture only is not enough to reproduce the exact problem that you are having.
This is why I would kindly ask you if it is possible to provide the pdf document that you load in RadPdfViewer and demonstrate the problem you are facing o provide exact steps about how to reproduce these fields' colors. Thus, I will try to load it on my side, inspect it further, and provide more details. Without replicating the exact problem first, it would be difficult to determine what has caused it on your end.
Looking forward to your reply.
Regards,
Nadya | Tech Support Engineer
Progress Telerik
Hi, Nadya. Please see attached. Thank you.
I am happy to hear that the provided solution is working for you. After a brief discussion on our side, we agree that this behavior is unexpected and the text needs to be visible while a dark theme is applied. That is why I have logged this in our Feedback Portal on your behalf where you can track its progress and follow the item so that you can receive status notification changes.
I have updated your Telerik Points for bringing this to our attention.