danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

Home Page:https://danfickle.github.io/pdf-templates/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Radio Button is not disabled / readonly

ThoSchCon opened this issue · comments

Hi,

I noticed that this html string for a radio button is not readonly in the generated pdf as expected.

<input type='radio' name='radio-input' readonly='' checked='' />
Expected behaviour:
The radio button in the generated pdf should be readonly.

Meanwhile for a checkbox readonly works as expected
<input type='checkbox' name='checker' readonly='' checked='' />

Setup
As suggested in the last release note I use the "FastMode".
PdfRendererBuilder builder = new PdfRendererBuilder().useFastMode();

openhtmltopdf version = 0.0.1-RC18

hi @ThoSchCon ,

a little bit late for the answer, but it seems it's not possible (easily): see https://answers.acrobatusers.com/How-do-I-disable-a-specific-radiobutton-in-a-set-of-radiobuttons-q25869.aspx .

I did try with pdfbox, and effectively it's not possible to disable a single radio button in a group.

Thank you for the hint! Appreciate you getting back to me ;-).

Best regards

Hi,

@syjer mentioned that you can't disable one radio button from the group but the whole group with the same name can be disabled. I tried to set readonly="" to every radio button input but it didn't help.

Any clues how I can disable the whole group of input radio buttons?

hi @aleks-shbln , currently I don't think it's implemented (in openhtmltopdf)

We also need this feature.
https://github.com/danfickle/openhtmltopdf/wiki/Form-Controlsdisabled / readonly works for other elements (checkbox, text, textarea), but not for the radio :(
It will be enough to just disable the whole group.

So there isn't any way to make the pdf readonly either?

(@dmitry-weirdo Plus one to that request)

@danfickle To get this fix working with the Pretty-Resume example project, what steps would I have to take? (For the https://github.com/danfickle/pretty-resume project, which I'm using for a test harness )

I've added some radio buttons in the HTML like so in the Experience section :

<div class="block">
                <div class="icon">
                    <i class="fa fa-suitcase"></i>
                </div>
                <div class="content">
                    <h2 th:text="${lang.headings.experience}"></h2>
                    <form >
                        <div class="div-with-padding">
                            <div>Radios with values 0, 1, 2. Checked works.</div>
                            <input type="radio" name="radio-1-name" value="0" id="radio-1-0" readonly="" />
                            <label for="radio-1-0">Radio 1, value 0</label>
                            <input type="radio" name="radio-1-name" value="1" id="radio-1-1" readonly="" />
                            <label for="radio-1-1">Radio 1, value 1</label>
                            <input type="radio" name="radio-1-name" value="2" id="radio-1-2" readonly="" />
                            <label for="radio-1-2">Radio 1, value 2</label>
                        </div>


                    </form>

                    <div class="item" th:each="experience : ${person.experience}">
                        <h3><span th:text="${experience.position}" /> - <span th:text="${experience.company}" /></h3>
                        <span th:text="${experience.timeperiod}"></span>
                        <p th:text="${experience.description}"></p>
                    </div>
                </div>
            </div>

I have tried to update the POM file to

<dependency>
  		<groupId>com.openhtmltopdf</groupId>
  		<artifactId>openhtmltopdf-pdfbox</artifactId>
  		<version>1.0.6</version>
  	</dependency>

From version 1.0.0. but it looks like that isn't sufficient to get checkboxes to be readonly.

Suggestions would be most welcomed: I have an upcoming demo to propose this project's adoption to my dev team.

No worries if you are too busy to respond,

Paul

hi @paulito-bandito , the fix has been committed after the release of 1.0.6, you will need to wait a little bit for the next release.

You can also build it yourself:

  • Download or clone
  • Run mvn install -DskipTests
  • This will build all modules and put them in your local maven repository.
  • Use installed modules, version will be 1.0.7-SNAPSHOT
  • Assumes you have Maven installed.