Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

a question on using xhtml2pdf to parse css from website

Tags:

python

I am trying to use xhtml2pdf to convert a webpage to pdf. After reading out the content of the webpage using urllib2, I found pisa.CreatePDF needs to process every link in the webpage content too. Especially, whenever it tried to parse .css file after I tried several websites, I got the following error:

pisa-3.0.33-py2.6.egg/sx/w3c/cssParser.py", line 1020, in _parseExpressionTerm
sx.w3c.cssParser.CSSParseError: Terminal function expression expected closing ')':: (u'Alpha(Opacity', u'=0); }\n\n\n\n.ui-state-')

Do you seem this issue too? Could anyone please help? Thanks a lot.

like image 426
Qiang Li Avatar asked Mar 06 '26 17:03

Qiang Li


1 Answers

pisa-3.0.33-py2.6.egg/sx/w3c/cssParser.py", line 1020, in _parseExpressionTerm sx.w3c.cssParser.CSSParseError: Terminal function expression expected closing ')':: (u'Alpha(Opacity', u'=0); }\n\n\n\n.ui-state-')

I think it was because it didn't recognize your css, which is alpha(opacity bla.. bla

I was having that problem before because of my javascript, I removed them and now it works.

like image 125
Mr.t Avatar answered Mar 09 '26 06:03

Mr.t



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!