5

I have a VF page that I'm rendering as a PDF file. I need to add some checkboxes to the PDF. I tried adding the inputCheckbox and the standard html checkbox input and neither show up when the VF page is rendered as a PDF. I even tried using the html entity codes (ascii character) for a white square checkbox, but that doesn't display either???

How can I get a checkbox to display in the VF page that is rendering as a PDF? I suppose I could use an image, but is there another option besides using an image?

Thanks for any help.

1 Answer 1

7

An apex:outputField works fine. Here is part of a PDF Visualforce page:

<tr>
    <th class="bordered">Offered</th>
    <th class="bordered">Offered Date</th>
    <th class="bordered">Accepted</th>
    <th class="bordered">Accepted Date</th>
    <th class="bordered">Description</th>
</tr>
<apex:repeat value="{!rehabilitations}" var="item">
<tr>
    <td class="bordered"><apex:outputField value="{!item.Offered__c}"/></td>
    <td class="bordered"><apex:outputField value="{!item.OfferedDate__c}"/></td>
    <td class="bordered"><apex:outputField value="{!item.Accepted__c}"/></td>
    <td class="bordered"><apex:outputField value="{!item.AcceptedDate__c}"/></td>
    <td class="bordered"><apex:outputField value="{!item.Description__c}"/></td>
</tr>
</apex:repeat>

that outputs this:

screen shot of table

The apex:outputField renders a checked or unchecked checkbox image that carries through to the PDF.

The images used are /img/checkbox_checked.gif and /img/checkbox_unchecked.gif. If your checkboxes are not fields, you could reference the images yourself in an IF.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .