i am rendering a visualforce page as PDF, but if the device is a mobile phone, the pdf is shown only for a small part, and the user needs to scroll to the right. Is there a way to always show the pdf as full page? Like i am seeing if from the desktop version.

<apex:page standardController="Account" showHeader="false" sidebar="false" renderAs="PDF">
              <apex:outputText escape="false" value="Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Lorem ipsum dolor sit amet, consectetuer adipiscing elit."  ></apex:outputText>


Current behaviour: enter image description here

Expected behaviour but with the mobile ratio as above:

enter image description here

When i turn the mobile phone everything works ok because there is enough width i guess : enter image description here

  • This is just the way your phone opens pdfs. You can't adjust that with your code. If you want a responsive design use a website.
    – Kasper
    Feb 4, 2022 at 16:18
  • Ok would this be possible with a lighting component that calls the visualforce page as pdf?
    – Brian23Gt
    Feb 4, 2022 at 16:23
  • Pdf's are meant for printing documents. They have a fixed layout so that when someone sends it to a printer the printer will know exactly what to print where. That means the publisher of the pdf is assured that it will look good. In the online world, pdfs are useful if you want to give your user information that they can easily save on their own computer or phone. If you want to give your user an easy to read website then you shouldn't use a pdf or base it on that. You can, if you want to, create a visualforce website that can also be rendered as a pdf but that can be quite the challenge.
    – Kasper
    Feb 4, 2022 at 16:35
  • Alternatively, you can build a website and than use javascript to render a pdf in the user's browser.
    – Kasper
    Feb 4, 2022 at 16:37
  • Yes my main goal is to display some rich text fields to an user, in my salesforce website. So i can easily add flow,visualforce or components to the page. The issue is that i want to have the text that changes the font size based on the website screen. This works no problem in a visualforce page with CSS, but it doesn't work with Rich text fields. That's why i opted to have a pdf which is always shown in the save way. I checked this : stackoverflow.com/a/30921225/16859335
    – Brian23Gt
    Feb 4, 2022 at 16:40


You must log in to answer this question.

Browse other questions tagged .