3

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

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

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.

  • This works- thank you very much for the explanation – Jake Sep 20 '18 at 18:51

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.