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
MiddhaMiddha 

Other Language Characters in PDF

Hi,

I am creating a PDF using Visualforce where i show data queried from salesforce object. This data contains text from various different languages like, japanese, korean, chinese etc.

This data gets rendered properly on Visalforce HTML page but does not appears on the PDF version.

Can aybody please advise on this. Thanks.
md1md1
We're facing the same problem so I hope there's a reply for this soon and possibly a simple solution too.
dchasmandchasman
Straight from the VF docs for <apex:page renderAs>:

renderAs The name of any supported content converter. Currently pdf is the only supported content converter. Setting this attribute to pdf renders the page as a pdf. Rendering a Visualforce page as a PDF is intended for pages that are designed and optimized for print. Standard components which are not easily formatted for print or contain form elements like inputs, buttons, any component that requires JavaScript to be formatted, should not be used. This includes but is not limited to, any component that requires a form element. Verify the format of your rendered page before deploying it. If the PDF fails to display all the characters, adjust the fonts in your CSS to use a font that supports your needs. For example, <apex:page renderas="pdf"> <style> body { font-family: Arial Unicode MS; } </style> Note that the pageBlock and sectionHeader components do not suppor double-byte fonts when rendered as a PDF.
TehNrdTehNrd
Would it be possible for the documentation to list the supported fonts for PDF generation? It can be frustrating when you are trying to setup fonts that the PDF rendering system likes when you have to guess and check.
dchasmandchasman
We do have a doc bug open on this but here is the info - could not resist publishing it in true Visualforce lingua franca form :smileyvery-happy:

Code:
<apex:page controller="PDFFontsController" renderAs="pdf" showHeader="false">
    <apex:repeat var="font" value="{!fonts}">
        <div style="font-family: {!font}">
            <div>{!font} 日本語</div>
            <div style="font-weight: bold">{!font} bold 日本語</div>
            <div style="font-style: italic">{!font} italic 日本語</div>
            <div style="font-weight: bold; font-style: italic">{!font} bold italic 日本語</div>
        </div>
    </apex:repeat>
</apex:page>

public class PDFFontsController {
    public String[] getFonts() {
        return fonts;
    }

    private static final String[] fonts = new String[] { 'Arial', 'Arial Unicode MS', 'Courier', 'Helvetica', 'Times-Roman' };
}





Message Edited by dchasman on 01-09-2009 08:41 PM
Rajesh ShahRajesh Shah
In the above display, the Times New Roman and Arial font are the same i.e. even for the Arial font, Times New Roman is generated. Can you tell us when will this bug be fixed?
dchasmandchasman
To be honest it's not not even on the road map at this point - tons of other work with much higher priority - same old story - and in this specific case we are using a third party library to perform the conversion to PDF and have found the vendor to be very very slow to respond (open source so we can't complain). My team has not had the time to investigate contributing the fix for this ourselves just yet.

Seems like this would be an excellent idea to post to the idea exchange (e.g. "Add additional font support to PDF generation") :-)
Rajesh ShahRajesh Shah
I also have another requirement wherein I need to generate barcode in a PDF file generated using Visualforce. From the above post, it seems like it would not be possible. Let me know about your views on it.
Check the following post.
http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=8537#M8537

Also I already found a idea posted on the above. Check that at the following link:
http://ideas.salesforce.com/article/show/10094848?page=last#lastPost

Thanks for the reply.
Cheriah200Cheriah200

Just wondered if this has been sorted yet as the last post was January. 

It would be extremely helpful to our company if the Arial font was supported.  We're struggling to send out quotes via Salesforce as we can generate a PDF version but if we want to send an email which generates an attachment it loses the bold, italic fomatting in Arial Unicode MS which then looks messy for customers.

 

The idea exchange link can be found here for anyone who would like to promote it!

 

http://ideas.salesforce.com/article/show/10094848/Add_More_Font_Support_for_PDF_Generation

TehNrdTehNrd

Arial is supported but you must define it has font-family: Arial Unicode MS.

 

There is a bug that causes it to return as Times New Roman if you only use 'Arial'

 

List of supported fonts and what they look like, not always correct.

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=8601#M8601

Message Edited by TehNrd on 06-23-2009 09:19 AM
Cheriah200Cheriah200

Thanks for the reply

 

I have already defined the font family as Arial Unicode MS but it still has no formatting - no bold or italic characters  I wondered if there was any progress on this?

Thanks

TehNrdTehNrd
I would also recommend putting all of the styles in a external stylesheet and then user the styleClass attributes. This seems to work a lot better with PDF creation.
sgoldberRHsgoldberRH

This is not working for me... the Chinese chars are simply not displaying ... here is my code

 

 

 

<apex:page standardController="SFDC_Channel_Account_Plan__c" extensions="ext_Objective,revenueDetails,MDFCalculate,goalInfo" showHeader="false" renderAs="pdf"> <apex:includeScript value="/soap/ajax/15.0/connection.js"/> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/15.0/apex.js"></script> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <table width="100%"> <tr> <td width="100%" bgcolor="#FFFFFF" align='CENTER'> <u><b><font size="4" face="Arial Unicode MS" >{!$Label.Channel_Partner_Business_Plan_Label}</font></b></u> </td>

 

 What am I doing wrong?

 

 

 

MiddhaMiddha

Try using:

 

<apex:outputLabel value="{!$Label.Channel_Partner_Business_Plan_Label}" style="font-family: Arial Unicode MS;"/>

 

 

 Instead:

<font size="4" face="Arial Unicode MS" >{!$Label.Channel_Partner_Business_Plan_Label}</font>

 

 

ptepperptepper
Here's another trick / weird behavior. If you're using javascript code editor with the Adobe Reader plugin running above it and you make a change, you generally won't see the change appear when you save the Visualforce code. So you may have it working and not know it. To show it, you need to navigate away from the page then come back to it. I like to just remove the renderAs="pdf" attribute, save, then put it back and save.
ministe2003ministe2003

Hi, what is the current exhaustive list of applicable PDF fonts, have there been any more added?

 

Regards

Steven

NielsSchepersNielsSchepers

I managed to get Arial and bold font weight using this code:

 

 

        <style type="text/css">
            body {font-family: "Arial" "Sans-Serif"; font-size:12px; }
        </style>

Hope it will work for you as well...

 

 

 

 

 

 

Dev3Dev3

Hi Doug,

 

What is the name of the third party library you are using to convert to PDF?

 

 

tquila_andytquila_andy

I have been successful in rendering a few non latin languages using the font style Arial Unicode MS.  

 

When I render Arabic characters there is additional whitespace being added eather side of each character.  Is there a known workaround or font style which supports all of Salesforce's supported languages?

 

The image attached to this tweet shows the arabic characters with space between them: https://twitter.com/andymahood__c/status/280975607251234816

 

etoeto

tquila_andy wrote:

I have been successful in rendering a few non latin languages using the font style Arial Unicode MS.  

 

When I render Arabic characters there is additional whitespace being added eather side of each character.  Is there a known workaround or font style which supports all of Salesforce's supported languages?

 


I had the same issue 4 years ago. The renderer simply does not support right to left so it puts the characters from left to right and as faras I remember in the wrong order. That then looks a bit weird and is totally unreadable.

 

hth

Srikanth Challa 3Srikanth Challa 3
Does salesforce support MS PGothic or Merio fonts when rendered as PDF?
jojo zhao 7jojo zhao 7
When I use system administrator login, visit the vf which is render As PDF, the system administrator language is Japanese, set body style as font-family:Arial Unicode MS; it works, but when I use another user, login as community user, then it doesn't work, anyone experience this situation?  The community template is Salesforce Tabs + Visualforce