Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Changing the color of a check mark of a checkbox in static PDF

Avatar

Level 3

Hi,

I am not sure if it's possible, but I am having trouble changing the check mark color of a checkbox in a static PDF.  It works fine if the PDF is dynamic, but it craps out when the PDF is static.

Is there a workaround?  I don't have to change it dynamically based on user interaction, the client just wants a blue checkmark in a static PDF.  Anyone having the same issue?

          var vName = this.somExpression;

          var fieldObj = xfa.resolveNode(vName + ".ui.#checkButton");

          // set up a variable to deal with the tick colour

          var myTick = event.target.getField(this.somExpression);

          myTick.textColor = color.blue;

          fieldObj.mark = "check";

This works when rendered as a Dynamic PDF, but myTick is always null when rendered as Static PDF

Cheers,

Nelson

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can change this by modifying the XML source.

Add the part to the checkbox source.

            <font>

               <fill>

                  <color value="153,204,0"/>

               </fill>

            </font>

It should look then something like:

<field name="CheckBox1" y="34.925mm" x="15.875mm" w="47.625mm" h="15.875mm">

            <ui>

               <checkButton mark="circle" size="7.0556mm">

                  <border>

                     <edge stroke="lowered"/>

                     <fill/>

                  </border>

               </checkButton>

            </ui>

            <font>

               <fill>

                  <color value="153,204,0"/>

               </fill>

            </font>

            <margin leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle"/>

            <value>

               <integer>0</integer>

            </value>

            <caption placement="right" reserve="29.3819mm">

               <para vAlign="middle" spaceAbove="0pt" spaceBelow="0pt" textIndent="0pt" marginLeft="0pt" marginRight="0pt"/>

               <font typeface="Myriad Pro" baselineShift="0pt"/>

               <value>

                  <text>Check Box</text>

               </value>

            </caption>

            <items>

               <integer>1</integer>

               <integer>0</integer>

               <integer>2</integer>

            </items>

         </field>

ColoredCheckBoxMark.png

View solution in original post

4 Replies

Avatar

Level 10

Hi Nelson,

I don't think so!

Niall

Avatar

Level 5

Hi,

If you are not doing this dynamically i.e. you want the check box to be blue all the time then you could just use this script on the initialise of the checkbox

this.fillColor = "0,0,255";

This does set all the font of the checkbox to blue, If you want the text to be black then I would think the best solution would be to not have a label specified with the checkbox but place a text block in the same location and then you could control the colour of each individually.

Hope this helps

Malcolm

Avatar

Correct answer by
Level 10

You can change this by modifying the XML source.

Add the part to the checkbox source.

            <font>

               <fill>

                  <color value="153,204,0"/>

               </fill>

            </font>

It should look then something like:

<field name="CheckBox1" y="34.925mm" x="15.875mm" w="47.625mm" h="15.875mm">

            <ui>

               <checkButton mark="circle" size="7.0556mm">

                  <border>

                     <edge stroke="lowered"/>

                     <fill/>

                  </border>

               </checkButton>

            </ui>

            <font>

               <fill>

                  <color value="153,204,0"/>

               </fill>

            </font>

            <margin leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle"/>

            <value>

               <integer>0</integer>

            </value>

            <caption placement="right" reserve="29.3819mm">

               <para vAlign="middle" spaceAbove="0pt" spaceBelow="0pt" textIndent="0pt" marginLeft="0pt" marginRight="0pt"/>

               <font typeface="Myriad Pro" baselineShift="0pt"/>

               <value>

                  <text>Check Box</text>

               </value>

            </caption>

            <items>

               <integer>1</integer>

               <integer>0</integer>

               <integer>2</integer>

            </items>

         </field>

ColoredCheckBoxMark.png

Avatar

Level 3

Thanks, that worked.

            <font>

               <fill>

                  <color value="0, 0, 255"/>

               </fill>

            </font>