4

Good Day, I'm having trouble with renderAs in a Visualforce PDF   developed a HTML to generate a pdf from a custom object, this would cover that contains HTML fullscreen but visulforce are putting margins and this is causing my HTML if unconfigure all, tried to put

 <style type="text/css">
  @ page {
    margin: 0in;
    margin: 0px;
    margin: 0cm;
  }
</ style>

  

But nothing works. Could you help me?

2
  • 1
    What does your <apex:page> look like? Are you overriding the Salesforce CSS styles? Commented Sep 26, 2012 at 14:32
  • Yes, i'm using my customized CSS. Commented Sep 26, 2012 at 14:37

1 Answer 1

6

This is a bit of a guess but I think you might have a small syntax issue. Remove the space between the @ and page

Example:

@page {
    size: 21.0cm 29.7cm;
    margin-top: 2.0cm;
    margin-left: 0cm;
    margin-right: 1.5cm;
    margin-bottom: 2cm;
}
4
  • 1
    Also - just found this which may be a nice resource for building PDFs: antennahouse.com/CSSInfo/CSS-Page-Tutorial-en.pdf Commented Sep 26, 2012 at 14:45
  • Very Nice man. Just Work! I Think its a small syntax issue because the space Commented Sep 26, 2012 at 14:51
  • Woot! Got to love those syntax issues. I dream of the day when the interface knows what we MEANT in our heads not what we actually typed:) Commented Sep 26, 2012 at 15:17
  • 3
    Can use W3C CSS Validation Service and paste your CSS into it and choose level 2. Would've given you Parse Error Lexical error at line 1, column 2. Encountered: " " (32), after : "@" Commented Sep 26, 2012 at 15:41

You must log in to answer this question.

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