function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ketan Solanki29Ketan Solanki29 

Checkbox not exported to PDF using Visualforce page

I have added visualfore page to export into pdf my content is exported to pdf working fine but the checkbox not exported into PDF.

 

 

Visualforce Page code :

 

<apex:page showHeader="false" renderAs="PDF" cache="true" controller="GeneratesPdfController" >

<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

<style type="text/css">
@page{
size:A4 portrait;

@bottom-right {
content: "Page " counter(page) " - " counter(pages);
font-family: 'Arial', 'Helvetica', sans-serif;
font-size:10px;
}
}
</style>
</head>
<apex:form>

 

My Checkbox : <input type="checkbox" name="mycheckbox" value="val1" checked="true" />

</apex:form>

</apex:page>

 

I got only My Checkbox : text in PDF but checkbox not shown on PDF with checked

 

Please help me on this.

Best Answer chosen by Admin (Salesforce Developers) 
hitesh90hitesh90

Hi Ketan,

 

Instead of Input checkbox you can use salesforce standard image to display checkbox as below.

 

Visualforce Page:

<apex:page showHeader="false" renderAs="PDF" cache="true"  >
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />    
    <style type="text/css">
        @page{
            size:A4 portrait;
            
            @bottom-right {
                content: "Page " counter(page) " - " counter(pages);
                font-family: 'Arial', 'Helvetica', sans-serif;
                font-size:10px;
            }
        }
    </style>
    </head>
    <apex:form>
    My Checkbox : 
                <img src="/img/checkbox_unchecked.gif"/>
                <img src="/img/checkbox_checked.gif"/>
    </apex:form>
</apex:page>

 

Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
My Blog:- http://mrjavascript.blogspot.in/

All Answers

hitesh90hitesh90

Hi Ketan,

 

Instead of Input checkbox you can use salesforce standard image to display checkbox as below.

 

Visualforce Page:

<apex:page showHeader="false" renderAs="PDF" cache="true"  >
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />    
    <style type="text/css">
        @page{
            size:A4 portrait;
            
            @bottom-right {
                content: "Page " counter(page) " - " counter(pages);
                font-family: 'Arial', 'Helvetica', sans-serif;
                font-size:10px;
            }
        }
    </style>
    </head>
    <apex:form>
    My Checkbox : 
                <img src="/img/checkbox_unchecked.gif"/>
                <img src="/img/checkbox_checked.gif"/>
    </apex:form>
</apex:page>

 

Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
My Blog:- http://mrjavascript.blogspot.in/

This was selected as the best answer
Ketan Solanki29Ketan Solanki29

Yes, i came to know that when we export checkbox from visualforce page to PDF it not displayed if we use html tag or apex tag.

Only image is the way to show checkbox in PDF.

 

Thanks Hitesh,