Richtige Weg, um fügen Sie ein Bild-Datei in ein PDF-Dokument generiert, mit Reportlab auf AppEngine Python

Ich versuche das generieren eines PDF-Berichts mit reportlab auf App Engine Python.

Aber ich weiß nicht wie man ein Bild Anhängen richtig.

Das Bild ist statisch.

Dies ist die Verzeichnisstruktur, die von meinem Projekt.

Richtige Weg, um fügen Sie ein Bild-Datei in ein PDF-Dokument generiert, mit Reportlab auf AppEngine Python

und das ist, was ich Tue (inside " chipas.py'), um das image:

im = Image('../static/logo.png',1*inch, 1*inch)
story.append(im)
...

Den stack-trace, den ich bekommen:

Traceback (most recent call last): File
"C:\Users\Lucas\Dropbox\Desarrollo\Python\windows\AppEngine\google\appengine\ext\webapp_webapp25.py",
Linie 701, die in nennen
handler.bekommen (*- Gruppen) - Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\chipas.py",
Zeile 1035, bekommen
doc.build(story) Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\doctemplate.py",
line 1117, in bauen
BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker-Datei)
"C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\doctemplate.py",
Linie 880, in bauen
selbst.handle_flowable(flowables) Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\doctemplate.py",
Linie 763, in handle_flowable
wenn Rahmen.add(f, canv, trySplit=selbst.allowSplitting): File "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\frames.py",
line 159, in _add
w, h = fließfähigen.wrap(aW, h) - Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\flowables.py",
line 408, in Verpackung
return self.drawWidth, selbst.drawHeight Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\flowables.py",
line 402, in getattr
selbst._setup_inner() Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\flowables.py",
Zeile 368, in _setup_inner
img = self._img-Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\platypus\flowables.py",
line 398, in getattr
selbst._img = ImageReader(selbst._file) - Datei "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\lib\utils.py",
line 541, in init
wenn _isPILImage(fileName): File "C:\Users\Lucas\Dropbox\Desarrollo\workspace\python\chipas-windows\src\reportlab\lib\utils.py",
line 521, in _isPILImage
return isinstance(im,Bild.Bild) AttributeError: 'NoneType' - Objekt hat kein Attribut 'Image' INFO 2012-02-29 19:54:37,276
dev_appserver.py:4247] "GET
/pdf-Datei?pedido=ahVkZXZ-Y2hpcGFzLWludGhlY2xvdWRyLwsSBlBlzglkbyijmjaxmi0wmi0yosaxoto1ndoxohrlc3razxhhbxbszs5jb20m
HTTP/1.1" 500 -

Was ist der richtige Weg, um fügen Sie ein Bild-Datei in ein pdf-Dokument generiert, mit reportlab?
Vielen Dank im Voraus!

Warum bist du nicht mit RML-markup? Es gibt Coole Kostenlose Bibliothek von Zope pypi.python.org/pypi/z3c.rml

InformationsquelleAutor Lucas | 2012-02-29

Schreibe einen Kommentar