4

Here is the beginning of my visualforce page:

    <apex:page StandardController="Project__c" extensions="projectToPDFController" renderAs="pdf" standardStylesheets="false">
<style> body { font-family: 'Arial Unicode MS'; } </style>

And this is how it is rendering: enter image description here

Any assistance would be greatly appreciated. Thank you!

***Edit

Here another example with less included on the page:

<apex:page StandardController="Project__c" renderAs="pdf" standardStylesheets="false">
<style> body { font-family: 'Arial Unicode MS'; } </style>

    Output
</apex:page>

enter image description here

2
  • have you wrapped your css in a <style> ? It is just assuming that is text rather than markup Commented Sep 20, 2018 at 18:00
  • Yes- and edited my post so it properly renders here.
    – Jake
    Commented Sep 20, 2018 at 18:31

1 Answer 1

6

The renderer only accepts style formats in the head section of the page:

<apex:page StandardController="Project__c" 
           extensions="projectToPDFController" 
           renderAs="pdf"
           showHeader="false"
           applyHtmlTag="false" 
           standardStylesheets="false">
    <html>
        <head>
            <style> body { font-family: 'Arial Unicode MS'; } </style>
        </head>
        <body>
            <!-- main content here -->
        </body>
    </html>
</apex:page>

You might find it easier to use apex:stylesheet so you don't need to include all the extra header information in your code, although this requires uploading your CSS as a Static Resource in order to use it.

1
  • This works- thank you very much for the explanation
    – Jake
    Commented Sep 20, 2018 at 18:51

You must log in to answer this question.

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