Change Question Title Colors
This demo example shows how to change the color of question titles in a generated PDF form. This feature is especially useful for quiz and test results—you can visually indicate correctly and incorrectly answered questions using color. To generate a PDF form with applied customizations, answer the quiz questions and click the "Save as PDF" button.
To implement title customization, you first need to understand the structure of a PDF document. Each element in a PDF form consists of PDF bricks—small building blocks that specify what and where to render on a PDF page. To customize question titles, you need to modify their PDF bricks within the onRenderQuestion
event. Its options.bricks
parameter provides access to an array of bricks that correspond to an individual form field. Log this parameter to the browser's console or set a debugger within the event handler and examine the bricks array to identify the brick you need to customize. Refer to the code listing for more information.