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? – Salesforce Wizard Sep 26 '12 at 14:32
  • Yes, i'm using my customized CSS. – Guilherme Gobetti Sep 26 '12 at 14:37
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 – Salesforce Wizard Sep 26 '12 at 14:45
  • Very Nice man. Just Work! I Think its a small syntax issue because the space – Guilherme Gobetti Sep 26 '12 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:) – Salesforce Wizard Sep 26 '12 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 : "@" – Peter Knolle Sep 26 '12 at 15:41

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.