Kozea / WeasyPrint

The awesome document factory
https://weasyprint.org
BSD 3-Clause "New" or "Revised" License
7.14k stars 681 forks source link

Does WeasyPrint support @page content flow() #554

Closed yejialin closed 6 years ago

yejialin commented 6 years ago

i need set multi-line headers in my table-pdf like Line 1 --- the title Line 2 --- the datetime i found a way to solve this problem is using flow() in @page in every page content,

@page {
    margin-top: 100px;
    @top {
        content: flow(header);  
        border-bottom: solid red
    }
}

but i try this and it looks like flow() can not parse in weasyprint

thanks a lot

liZe commented 6 years ago

I'm not sure to understand exactly what you want, but you can insert multi-line content in headers with an escaped line-feed character and a white-space attribute to keep it:

@page {
    @top-center {
        content: 'title\00000adatetime';
        white-space: pre-line;
    }
}

Where did you find the flow hack, I can't find it in specs or even on MDN?

yejialin commented 6 years ago

thank you so much !! This is exactly what I want

and i found flow() in http://www.princexml.com/doc/page-headers-footers/ I think it can put a whole element into the content(such as a custom div)

one more question : what is \00000a, where can i find the features like that~

liZe commented 6 years ago

and i found flow() in http://www.princexml.com/doc/page-headers-footers/

Oh, that's a special feature of Prince, thanks for the link!

what is \00000a, where can i find the features like that~

https://stackoverflow.com/questions/9062988/newline-character-sequence-in-css-content-property

Have fun!