w--
w--

Reputation: 6667

need xhtml2pdf (Pisa 3.0) css syntax for @page and @frame

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...

Upvotes: 3

Views: 5992

Answers (1)

JamesO
JamesO

Reputation: 25936

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

Upvotes: 6

Related Questions