Changing Form Fields Color on a Fillable PDF

4 Answers 21 Views
PdfViewer and PdfViewerNavigator
Hon
Top achievements
Rank 1
Iron
Hon asked on 11 Apr 2024, 02:56 PM

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

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 19 Apr 2024, 10:41 AM

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

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com
0
Nadya | Tech Support Engineer
Telerik team
answered on 16 Apr 2024, 09:19 AM

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

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com
0
Hon
Top achievements
Rank 1
Iron
answered on 16 Apr 2024, 02:10 PM

Hi, Nadya. Please see attached. Thank you.

0
Hon
Top achievements
Rank 1
Iron
answered on 19 Apr 2024, 01:23 PM
Thanks, Dinko. That works.
Dinko | Tech Support Engineer
Telerik team
commented on 22 Apr 2024, 12:33 PM

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.

Tags
PdfViewer and PdfViewerNavigator
Asked by
Hon
Top achievements
Rank 1
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Nadya | Tech Support Engineer
Telerik team
Hon
Top achievements
Rank 1
Iron
Share this question
or