[IMP] Merge the pdf documents into a StringIO and not a File

bzr revid: sle@openerp.com-20140218131414-khmd3gy8dbjedmrg
This commit is contained in:
Simon Lejeune 2014-02-18 14:14:14 +01:00
parent 3c6c3d91d5
commit 68115b2c6f
1 changed files with 6 additions and 2 deletions

View File

@ -31,6 +31,11 @@ import tempfile
import lxml.html
import subprocess
import simplejson
try:
import cStringIO as StringIO
except ImportError:
import StringIO
from pyPdf import PdfFileWriter, PdfFileReader
from werkzeug.test import Client
@ -421,8 +426,7 @@ class Report(http.Controller):
for page in range(0, reader.getNumPages()):
writer.addPage(reader.getPage(page))
document.close()
merged = tempfile.NamedTemporaryFile(suffix='.pdf', prefix='report.tmp.', mode='w+b')
merged = StringIO.StringIO()
writer.write(merged)
merged.seek(0)
content = merged.read()