Darth Blue Ray
Darth Blue Ray

Reputation: 9745

checkbox itext - how

I made a pdf with iText and at the moment I'm showing a booleanfield as text, stating true or false. Now I was thinking to change this visualisation to a checkbox. False -> unchecked / true -> checked. If it's possible of course.

I tried to google it but I get results of using active checkboxes for itext and so on. I just need a visualisation of a boolean field in the pdf document I create

At the moment I just use :

...
Phrase validation = new Phrase();
        validation.add(new Chunk(" Approved =  "
                + documentName.getApproved(), BOLD));
...

document.add(validation);

Upvotes: 2

Views: 5488

Answers (1)

Alexis Pigeon
Alexis Pigeon

Reputation: 7512

Have a look at this example : Filling out interactive forms.

It shows how ot create a form and fill some of the fields, among these, some checkboxes.


EDIT :

You can then flatten the form, making these checkboxes not interactive anymore : Form flattening

Another approach would be to insert a symbol depending on the boolean value. If the boolean is false, insert an empty box, if true, insert a marked/ticked/checked box.

Upvotes: 2

Related Questions