4

I just had the problem to create a VF page that renders as a pdf and outputs polish text. The only font that supports polish characters is Arial Unicode MS but with this font, I can't output bold or italic, the renderer simply ignores it. The other fonts work as expected but there the special characters are missing.

Anyone out there who found a workaround to format the text in bold/italic with Arial Unicode MS?

2
  • 1
    Are you using custom CSS and do you have an <apex:pageMessages id="messages"> tag on your page? I've found that if anything goes wrong while processing a page, it can cause all sorts of other formatting problems. For the special characters, have you tried using their c-map numbers in order to get them to display? As a final thought, are the fonts installed on the machine you're using to view the PDF?? I don't know if they always get embedded in SF's PDF generator which is an option one can set with Acrobat Distiller.
    – crmprogdev
    Mar 26 '13 at 21:32
  • I ran across this post today and wondered if you'd seen it. Perhaps it might provide some insight into your problem and lead to a possible solution.
    – crmprogdev
    Mar 29 '13 at 14:50
3

After version 27, users have to add applyBodyTag="false" to render double-byte PDF as usual.

<apex:page ... renderAs="pdf" **applyBodyTag="false"**>

ref: http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_renderas_pdf.htm

2

Do you have your CSS styling wrapped in <head> </head>? Normally, this wrapper isn't needed for Visualforce, but I've found it necessary to have my CSS classes work when rendering as a PDF.


My PDF Template

<apex:page 
    showHeader="false" 
    sidebar="false"
    standardStylesheets="false"
    renderAs="pdf"
    docType="html-5.0"
    applyHtmlTag="false"
    applyBodyTag="false"
>
    <html>
        <head>
            <style type="text/css" media="print">
                @page {
                    margin: 0.1in;
                }

            </style>
        </head>
        <body>

        </body>
    </html>
</apex:page>
3
  • That makes no impact. I have outputText in my pdf page and I add inline styles to it. For example, I add red color and font-weight 800, without renderas="pdf" text is red and bold, but as pdf it is red only Apr 14 '16 at 18:32
  • Inline styles always work. Whenever I make PDFs, I have <apex:page applyBodyTag="false" applyHtmlTag="false" ...> and manually add the <html> and <body> tags. Then I put my CSS Classes in a <head>. Apr 14 '16 at 18:34
  • But in this case issue is with font only. I have the same issue - salesforce.stackexchange.com/questions/118055/… Apr 14 '16 at 18:37
2

Relaying my findings from the more recent question: visualforce page as PDF - unicode font bold characters


According to Flying Saucer PDF Generator and Unicode you need a special variant build of Flying Saucer to:

generate the appropriate PDF commands to emulate bold and italics when a style calls for it but no matching font can be found.

From the Features of this Release:

Added font emulation for bold and italics variations when there is no direct support in the font files themselves. Fonts like Microsoft's Arial Unicode MS only come in one version: plain text. In order to have bold, italics and bold+italics the font must be modified on-the-fly by the PDF display software.

So, unless Salesforce were using a variation of Flying Saucer or switch to another PDF renderer it won't be possible.

As per the comment by Oleksiy, voting for the idea Arial Unicode MS - Bold in PDF may help in the long run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.