Skip to main content
added 64 characters in body
Source Link
Daniel Hoechst
  • 25.2k
  • 7
  • 81
  • 115

I am trying to create a Visualforce page that renders as PDF. My problem is that I want to display as much of a rich text field as can fit. If I use overflow: hidden in my CSS, the text is displayed, but I get blank pages that would be where the additional content would go if it weren't hidden. I can even drag and select the hidden text on the PDF.

Is there a way to use CSS in a VF page rendered as PDF to actually cut the text off?

<apex:page renderas="pdf" standardController="Account" showHeader="false" applyhtmltag="false">
    <head>
    <style>
    @page { 
        size: 8.5in 11in;
        @top-right {
            content: 'Page ' counter(page) ' of ' counter(pages);
            font-style: bold;
        }
    }
    h1 {
        max-height: 200px;
        overflow: hidden;
    }
    </style>
    </head>
    <h1>{!Account.Description}</h1>
    
</apex:page>

I am trying to create a Visualforce page that renders as PDF. My problem is that I want to display as much of a rich text field as can fit. If I use overflow: hidden in my CSS, the text is displayed, but I get blank pages that would be where the additional content would go if it weren't hidden.

Is there a way to use CSS in a VF page rendered as PDF to cut the text off?

<apex:page renderas="pdf" standardController="Account" showHeader="false" applyhtmltag="false">
    <head>
    <style>
    @page { 
        size: 8.5in 11in;
        @top-right {
            content: 'Page ' counter(page) ' of ' counter(pages);
            font-style: bold;
        }
    }
    h1 {
        max-height: 200px;
        overflow: hidden;
    }
    </style>
    </head>
    <h1>{!Account.Description}</h1>
    
</apex:page>

I am trying to create a Visualforce page that renders as PDF. My problem is that I want to display as much of a rich text field as can fit. If I use overflow: hidden in my CSS, the text is displayed, but I get blank pages that would be where the additional content would go if it weren't hidden. I can even drag and select the hidden text on the PDF.

Is there a way to use CSS in a VF page rendered as PDF to actually cut the text off?

<apex:page renderas="pdf" standardController="Account" showHeader="false" applyhtmltag="false">
    <head>
    <style>
    @page { 
        size: 8.5in 11in;
        @top-right {
            content: 'Page ' counter(page) ' of ' counter(pages);
            font-style: bold;
        }
    }
    h1 {
        max-height: 200px;
        overflow: hidden;
    }
    </style>
    </head>
    <h1>{!Account.Description}</h1>
    
</apex:page>
Tweeted twitter.com/#!/StackSalesforce/status/491377929314918400
Source Link
Daniel Hoechst
  • 25.2k
  • 7
  • 81
  • 115

Visualforce PDF and CSS overflow: hidden

I am trying to create a Visualforce page that renders as PDF. My problem is that I want to display as much of a rich text field as can fit. If I use overflow: hidden in my CSS, the text is displayed, but I get blank pages that would be where the additional content would go if it weren't hidden.

Is there a way to use CSS in a VF page rendered as PDF to cut the text off?

<apex:page renderas="pdf" standardController="Account" showHeader="false" applyhtmltag="false">
    <head>
    <style>
    @page { 
        size: 8.5in 11in;
        @top-right {
            content: 'Page ' counter(page) ' of ' counter(pages);
            font-style: bold;
        }
    }
    h1 {
        max-height: 200px;
        overflow: hidden;
    }
    </style>
    </head>
    <h1>{!Account.Description}</h1>
    
</apex:page>