Saikat Chakrabarti
unread,Nov 25, 2009, 8:23:04 PM11/25/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Pisa XHTML2PDF Support
I am trying to convert an HTML document to a PDF. I sent an E-mail
previously about data-uris, but after some more debugging, turns out
that is not the problem. The following HTML works great:
<img src="data:image/
png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAAAKCAYAAACT1z1LAAAAt0lEQVRYCWNkGAUjJgTU1NSOAD3L8e/
fP887d+68hnmcCcYYpUdECHAAfWnMyMi4X0VFRRTm49FEAAuJEUCDSoD///
9fBSYCbeSEwDgC/
D7qRaQQAJUAoAQASgigBAHEjozQesIaSd0oc2SFwNfR6mBkRThW345WB1iDZfgKYq0Ohq93R32GHgLYEgCoq8iCrnCUP3xDgImJaTvQd/
AGIWysYLRNMHzjHJvPfgAFz4B6BLAEAFIEABgZRXYd8gaMAAAAAElFTkSuQmCC"
style="top: 0px; left: 0px; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; z-index: -100; overflow-x:
hidden; overflow-y: hidden; position: absolute; visibility: visible;
">
But running pisa -ws <file> where <file> contains the following causes
problems:
<div style="overflow-x: hidden; overflow-y: hidden; position:
absolute; visibility: visible; z-index: 0; left: 36px; top: 81px;
width: 129px; height: 10px; ">
<img src="data:image/
png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAAAKCAYAAACT1z1LAAAAt0lEQVRYCWNkGAUjJgTU1NSOAD3L8e/
fP887d+68hnmcCcYYpUdECHAAfWnMyMi4X0VFRRTm49FEAAuJEUCDSoD///
9fBSYCbeSEwDgC/
D7qRaQQAJUAoAQASgigBAHEjozQesIaSd0oc2SFwNfR6mBkRThW345WB1iDZfgKYq0Ohq93R32GHgLYEgCoq8iCrnCUP3xDgImJaTvQd/
AGIWysYLRNMHzjHJvPfgAFz4B6BLAEAFIEABgZRXYd8gaMAAAAAElFTkSuQmCC"
style="top: 0px; left: 0px; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; z-index: -100; overflow-x:
hidden; overflow-y: hidden; position: absolute; visibility: visible;
">
</div>
The output of the pisa command is:
Tassatop-2:Desktop saikat$ pisa -ws test1.html
/Library/Python/2.6/site-packages/pyPdf/pdf.py:52: DeprecationWarning:
the sets module is deprecated
from sets import ImmutableSet
Converting test1.html to /Users/saikat/Desktop/test1.pdf...
/Library/Python/2.6/site-packages/html5lib-0.11.1-py2.6.egg/html5lib/
inputstream.py:367: DeprecationWarning: object.__init__() takes no
parameters
WARNING [ho.pisa] Error in handling image
u'<img src="data:image/
png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAAAKCAYAAACT1z1LAAAAt0lEQVRYCWNkGAUjJgTU1NSOAD3L8e/
fP887d+68hnmcCcYYpUdECHAAfWnMyMi4X0VFRRTm49FEAAuJEUCDSoD///
9fBSYCbeSEwDgC/
D7qRaQQAJUAoAQASgigBAHEjozQesIaSd0oc2SFwNfR6mBkRThW345WB1iDZfgKYq0Ohq93R32GHgLYEgCoq8iCrnCUP3xDgImJaTvQd/
AGIWysYLRNMHzjHJvPfgAFz4B6BLAEAFIEABgZRXYd8gaMAAAAAElFTkSuQmCC"
style="top: 0px; left: 0px; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; z-index: -100; overflow-x:
hidden; overflow-y: hidden; position: absolute; visibility: visible; "/
>'
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/pisa-3.0.32-py2.6.egg/sx/
pisa3/pisa_tags.py", line 297, in start
img.drawWidth *= img.pisaZoom
TypeError: can't multiply sequence by non-int of type 'float'
Open viewer for file /Users/saikat/Desktop/test1.pdf
The generated pdf is blank. Any ideas on how to get this working?
Thanks!
Saikat