0

I need to render a small pdf page, height = 15mm and width = 30 mm.
I have developed a VF page but I am not able to get the required page size.

I am getting the error 'Page style attributes result in invalid (negative) page size.'

Below is my code:

<apex:page renderAs="pdf" standardController="Account" standardStylesheets="false" cache="false" showHeader="false" sidebar="false" applyHtmlTag="true" applyBodyTag="false"  >
    <head>
        <style type = "text/css">
            @page { 
                size: landscape;
                size:15mm 30mm!important;
            }   
        </style>
    </head>

    <apex:outputText value="test"></apex:outputText>

</apex:page>

I can't figure out the CSS to apply.
Please help.

1 Answer 1

1

Page style attributes result in invalid (negative) page size. It means you are defining the page size which is not acceptable for rendering a page as pdf. It expects at least size:25.5mm 25.5mm!important; or greater than that.

Here, the first parameter is the width of the page and the second one is the height of the page.

The page will look like this:- pdf

Try below code, it will give you a page size of 25.5mm square:-

    <apex:page renderAs="pdf" standardController="Account" standardStylesheets="false" cache="false" showHeader="false" sidebar="false" applyHtmlTag="true" applyBodyTag="false"  >
    <head>
        <style type = "text/css">
            @page { 
                size: landscape;
                size:25.5mm 25.5mm!important;
            }   
        </style>
    </head>
</apex:page>
2
  • Thanks. Any documentation where it says size should be at least 25.5mm x 25.5mm?
    – S..
    Commented Oct 30, 2018 at 5:52
  • I could not find any but you can try.. It will give you the error. I just analysed it by trY and error. Commented Oct 30, 2018 at 6:40

You must log in to answer this question.

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