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
Lukas Razim 26Lukas Razim 26 

Visualforce Render as pdf - special characters missing

Hi,
Im trying to render visualforce page as pdf. We have special characters in my language such as ě,š,č,ř,ž,ý,á,í. Some of them are missing on the pdf (e.g. č or ř) while the rest of them are there fine. Can anyone help me with this?
Thank you very much 
Best Answer chosen by Lukas Razim 26
pconpcon
The problem is that most fonts don't contain the right unicode characters required to render those characters.  You can set the font in the pdf [1] and this resolves your issue.  Below is an example of a Visualforce page that will show you how the render in different fonts supported by the platform:
 
<apex:page showHeader="false" renderAs="pdf">
    <table border="1" cellpadding="6">
		<tr>
            <th>Font Name</th>
            <th>Style <code>font-family</code> Value to Use (Synonyms)</th>
        </tr>
		<tr>
            <td><span style="font-family: Arial Unicode MS; font-size: 14pt; ">Arial Unicode MS</span></td>
            <td>
                <ul>
					<li>
                        <span style="font-family: Arial Unicode MS; font-size: 14pt;">Arial Unicode MS - ě,š,č,ř,ž,ý,á,í</span>
                    </li>
				</ul>
            </td>
        </tr>
		<tr>
            <td><span style="font-family: Helvetica; font-size: 14pt;">Helvetica</span></td>
    		<td>
                <ul>
					<li><span style="font-family: sans-serif; font-size: 14pt;">sans-serif - ě,š,č,ř,ž,ý,á,í</span></li>
					<li><span style="font-family: SansSerif; font-size: 14pt;">SansSerif - ě,š,č,ř,ž,ý,á,í</span></li>
					<li><span style="font-family: Dialog; font-size: 14pt;">Dialog - ě,š,č,ř,ž,ý,á,í</span></li>
				</ul>
            </td>
        </tr>
		<tr>
            <td><span style="font-family: Times; font-size: 14pt;">Times</span></td>
            <td>
                <ul>
                   <li><span style="font-family: serif; font-size: 14pt;">serif - ě,š,č,ř,ž,ý,á,í</span></li>
                   <li><span style="font-family: Times; font-size: 14pt;">Times - ě,š,č,ř,ž,ý,á,í</span></li>
				</ul>
            </td>
        </tr>
		<tr>
            <td><span style="font-family: Courier; font-size: 14pt;">Courier</span></td>
            <td>
                <ul>
                    <li><span style="font-family: monospace; font-size: 14pt;">monospace - ě,š,č,ř,ž,ý,á,í</span></li>
                    <li><span style="font-family: Courier; font-size: 14pt;">Courier - ě,š,č,ř,ž,ý,á,í</span></li>
                    <li><span style="font-family: Monospaced; font-size: 14pt;">Monospaced - ě,š,č,ř,ž,ý,á,í</span></li>
                    <li><span style="font-family: DialogInput; font-size: 14pt;">DialogInput - ě,š,č,ř,ž,ý,á,í</span></li>
                </ul>
            </td>
		</tr>
	</table>
</apex:page>

Based on it's ouput (image below) the only font that supports all the characters is Arial Unicode MS. So you'll want to use that

User-added image

All Answers

pconpcon
Can you please provide a simple Visualforce page that reproduces this issue?
Nishant Dubey 7Nishant Dubey 7
Serbian characters š,đ,č,ć,ž are not included in Abode. please visit adobe site or following link
https://forums.adobe.com/message/3265826
Lukas Razim 26Lukas Razim 26
@pcon: For example this one below it is from salesforce labs app Invoice, Quote, Order. I wanted to translate this one but when I for example use číslo faktury instead of Invoice Number, the č is missing.

<apex:page standardController="Opportunity" showHeader="false" renderas="pdf">

<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>
    <td>
        <img src='{!URLFOR($Resource.Logo4567687)}' title="logo" />
    </td>
    <td  align="right"><font face="Arial" >
    <b>Invoice for {!Opportunity.Account.Name}</b></font><br/>
   </td>
   
  
    
</tr>

<hr/>

</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>    <td><font face="Arial" >
        {!$Organization.Name}<br/>
        {!$Organization.Street}<br/>
        {!$Organization.PostalCode} {!$Organization.City}<br/>
        {!$Organization.Country}<br/>
        </font></td> 
        <td width="60%">&nbsp;</td>
   <td ><font face="Arial">Invoice number (číslo faktury): <apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
   {!line2.name}</apex:repeat></font><br/>
  
   
   <font face="Arial">Invoice Date: <apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
   {!line2.Invoice_Date__c}  </apex:repeat></font></td>
 
   
  
</tr>
</table>
<br/>
<hr/>
<p><b><font face="Arial" color="#000080">Address Information</font></b></p>

<table border="0" width="100%" id="table2">
<tr>
       <td colspan="3">
           <font face="Arial">Account name: {!Opportunity.Account.Name} <br/><br/></font>
       </td>
</tr>
<tr>
       <td>          
           <font face="Arial">Bill To:<br/>
                             {!Opportunity.Account.BillingStreet}<br/>
                             {!Opportunity.Account.BillingPostalCode} {!Opportunity.Account.BillingCity}
           </font>
        </td>
        <td width="50%"></td>
        <td >
           <font face="Arial">Ship To:<br/>
                              {!Opportunity.Account.ShippingStreet}<br/>
                              {!Opportunity.Account.ShippingPostalCode} {!Opportunity.Account.ShippingCity}
           </font>
        </td>
</tr>    
</table>
<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Products</font></b></p>
<table border="0" width="100%" id="table4">
<tr>
       <td bgcolor="#C0C0C0"><font face="Arial">Product</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Description</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Image</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Quantity</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Unit Price</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Total Price</font></td>
</tr>
<tr>
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
          <tr>
             <td>{!line.PricebookEntry.Name}</td>
             <td>{!line.Description}</td>
             <td ALIGN="center"><img src='{!line.PricebookEntry.Product2.URL_Picture__c}'/></td>             
             <td>{!line.Quantity}</td>
             <td><apex:OutputField value="{!line.UnitPrice}"/></td>
             <td><apex:OutputField value="{!line.TotalPrice}"/></td>
          </tr>
       </apex:repeat>  
</tr>
<tr>
       <td bgcolor="#C0C0C0" align="right" colspan="6">
       <font face="Arial"><b>Total:</b>&nbsp;<apex:OutputField value="{!Opportunity.Amount}"/></font></td>
</tr>
</table>
<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Terms and Conditions</font></b></p>
<table border="0" width="100%" id="table3">
<tr>
        
       
        <td><font face="Arial">
              Payment Method:&nbsp;<apex:OutputField value="{!Opportunity.QuotePaymentMode__c}"/><br/>
              Payment Terms:&nbsp; <apex:OutputField value="{!Opportunity.QuotePaymentTime__c}"/><br/>
              Billing Frequency:&nbsp; <apex:OutputField value="{!Opportunity.QuoteBillingFrequency__c}"/><br/>
            </font>
       </td>
</tr>
</table>
<br/>
<p><font face="Arial">{!Opportunity.Conditions__c}</font></p>
<br/>
<hr/>
<table width="100%" id="table5">
Special Terms:
</table>
<p>&nbsp;</p>
<hr/>
<p align="center"><font face="Arial"><i>Copyright {!$Organization.Name}.</i></font></p>
</apex:page>
Lukas Razim 26Lukas Razim 26
@Nishant: Im not sure if understand, what does it have to do with Adobe in this case? Sorry, Im not really developer oriented so I might have stupid questions to you. Thanks very much
pconpcon
The problem is that most fonts don't contain the right unicode characters required to render those characters.  You can set the font in the pdf [1] and this resolves your issue.  Below is an example of a Visualforce page that will show you how the render in different fonts supported by the platform:
 
<apex:page showHeader="false" renderAs="pdf">
    <table border="1" cellpadding="6">
		<tr>
            <th>Font Name</th>
            <th>Style <code>font-family</code> Value to Use (Synonyms)</th>
        </tr>
		<tr>
            <td><span style="font-family: Arial Unicode MS; font-size: 14pt; ">Arial Unicode MS</span></td>
            <td>
                <ul>
					<li>
                        <span style="font-family: Arial Unicode MS; font-size: 14pt;">Arial Unicode MS - ě,š,č,ř,ž,ý,á,í</span>
                    </li>
				</ul>
            </td>
        </tr>
		<tr>
            <td><span style="font-family: Helvetica; font-size: 14pt;">Helvetica</span></td>
    		<td>
                <ul>
					<li><span style="font-family: sans-serif; font-size: 14pt;">sans-serif - ě,š,č,ř,ž,ý,á,í</span></li>
					<li><span style="font-family: SansSerif; font-size: 14pt;">SansSerif - ě,š,č,ř,ž,ý,á,í</span></li>
					<li><span style="font-family: Dialog; font-size: 14pt;">Dialog - ě,š,č,ř,ž,ý,á,í</span></li>
				</ul>
            </td>
        </tr>
		<tr>
            <td><span style="font-family: Times; font-size: 14pt;">Times</span></td>
            <td>
                <ul>
                   <li><span style="font-family: serif; font-size: 14pt;">serif - ě,š,č,ř,ž,ý,á,í</span></li>
                   <li><span style="font-family: Times; font-size: 14pt;">Times - ě,š,č,ř,ž,ý,á,í</span></li>
				</ul>
            </td>
        </tr>
		<tr>
            <td><span style="font-family: Courier; font-size: 14pt;">Courier</span></td>
            <td>
                <ul>
                    <li><span style="font-family: monospace; font-size: 14pt;">monospace - ě,š,č,ř,ž,ý,á,í</span></li>
                    <li><span style="font-family: Courier; font-size: 14pt;">Courier - ě,š,č,ř,ž,ý,á,í</span></li>
                    <li><span style="font-family: Monospaced; font-size: 14pt;">Monospaced - ě,š,č,ř,ž,ý,á,í</span></li>
                    <li><span style="font-family: DialogInput; font-size: 14pt;">DialogInput - ě,š,č,ř,ž,ý,á,í</span></li>
                </ul>
            </td>
		</tr>
	</table>
</apex:page>

Based on it's ouput (image below) the only font that supports all the characters is Arial Unicode MS. So you'll want to use that

User-added image
This was selected as the best answer
Lukas Razim 26Lukas Razim 26
got it @pcon it works great Thank you!!