3

i'm trying stuff out with xhtml2pdf (aka Pisa 3.0) and django and am having trouble with the css
http://www.xhtml2pdf.com/doc/pisa-en.html
obviously the docs above talk about the css that is available as well as vendor specific tags.

If i follow the example in the docs for static frames and make css like

@page{
        margin:0cm;
        @frame header{
            -pdf-frame-content: header;
            height: 3cm;    
        }
        @frame footer{
            -pdf-frame-content: footer;
            bottom: 2cm;
            height: 2cm;
        }
    }

    .main_content{
        padding: 0px
    }
    #header{

        background-color: #02164c;
        font: #FFFFFF;
        width:100%;     
    }
    #footer{    
        width: 100%;            
    }
    .pageBreak{
        page-break-after: always;       
    }

I get an error in django

Exception Value:

Ruleset opening '{' not found:: (u'@page{\n\t\tmargin:', u'0cm;\n\t\t@frame header')

Exception Location: /usr/lib/pymodules/python2.6/sx/w3c/cssParser.py in _parseAtPage, line 654

it looks like the css parser is croaking on @page.
To me it looks like i'm using it as in the examples. I'm hoping someone can help provide some guidance on this or point me to some template examples.
I also am wondering how to use the -pdf- vendor specific tags. there is no documentation on these tags that i can find...

3
  • Checked this against a pdf i generate (which gave the same error) the only thing i could see was the lack of a space after @page{ - i changed it to @page { and your code works for me. Any help? Commented Apr 6, 2011 at 8:00
  • @JamesO - wow. that was awesome. wth. yes it was the whitespace that was killing it. If you want to move your comment to an answer i will happily award it to you as there is no way i would've tried that on my own. On a side note, any additional resources on vendor specific tags and/or @page and @frame tags? Commented Apr 7, 2011 at 0:19
  • will do, glad it helped. Not sure about additional docs for vendor tags, I've only used the ones used in the examples at the link above. Commented Apr 7, 2011 at 8:05

1 Answer 1

6

@page{ seems to cause an error when there is no whitespace before the { changing to @page { works.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.