Вопрос

ReportLab/xhtml2pdf have worked perfectly until now when it crashes at this style bit in HTML:

<p style="border-style: initial; border-color: initial; border-image: initial; 
 font-family: Ubuntu-R; font-size: small; border-width: 0px; padding: 0px; 
 margin: 0px;">Done:</p>

with this error:

File "/usr/local/lib/python2.7/dist-packages/reportlab/lib/colors.py",
line 850, in __call__
    raise ValueError('Invalid color value %r' % arg)
ValueError: Invalid color value 'initial'

I use it typically like this:

     pdf = pisa.pisaDocument(StringIO.StringIO(html.encode('UTF-8')), 
result, encoding='UTF-8', link_callback=fetch_resources)

Is there a way to overcome this other than patching it's original code?

Это было полезно?

Решение

The border-style: initial value is not correct. See the code as a reference for supported border-style values:

  • none
  • hidden
  • dotted
  • dashed
  • solid
  • double
  • groove
  • ridge
  • inset
  • outset
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top