Python module Pisa: how change background color for all page?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 17:24:00

问题


How i can change background color of all page?

like this :

body,div { background-color:#f4f4f4; }

Now background changes only for div with information, remaining page have white color. if it is possible, can you write example?

P.s. How i can draw border around ?


回答1:


Acording to the documentacion https://github.com/chrisglass/xhtml2pdf/blob/master/doc/usage.rst#supported-page-properties-and-values @page only accept few css propierties:

background-image size margin, margin-bottom, margin-left, margin-right, margin-top

So maybe the easyest is to make a jpg to draw the background with background color and border. And use that image in background-image propierty:

@page {background-image: url('local_path/to/your/image.jpg')}



回答2:


I hope this will help you

html,body{height:100%}
body,div { background-color:#f4f4f4; }

and your Second Question > How i can draw border around ?

add

border:1px #ccc solid


来源:https://stackoverflow.com/questions/19348998/python-module-pisa-how-change-background-color-for-all-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!