On Saturday, April 16, 2011 2:23:38 am Sibylle Koczian wrote:
> Am 15.04.2011 21:39, schrieb Adrian Klaver:
> >> Creating and showing either one of the reports using the file name as
> >> rw.OutputFile property and rw.write() works as expected, so the reports
> >> themselves seem to be correct. But I want to get them into one file and
> >> print them on one page, without resorting to a separate PDF Editor, if
> >> at all possible.
> >> 
> >> How should I do it?
> > 
> > Have you tried not specifying the OutputFile until you after you add the
> > second report:
> > 
> > rw.ReportFormFile = "myform_2.rfxml"
> > rw.OutputFile = outFile
> 
> I don't understand: wouldn't that mean I must call rw.write() at least
> once before specifying the OutputFile, to get the first report?

It was playing a hunch based on looking at the code.
> 
> But it seems this isn't supposed to work any more. So I'll try to merge
> the reports with Ghostscript.

Actually it does seem to work. Using the demo invoice.rfxml file either of the 
methods below seem to work:

pdfName = "myreps.pdf"
rw = ReportWriter()
with open(pdfName, "w") as outFile:
     rw.ReportFormFile = "invoice.rfxml"
     rw.OutputFile = outFile
     # for testing
     rw.UseTestCursor = True
     rw.write(save=False)
     rw.ReportFormFile = "invoice_2.rfxml"
     rw.UseTestCursor = True
     rw.write()
     outFile.close()

Note the outFile.close()

or stealing shamelessly from the reportWriter.py code:

import tempfile
pdfName = "myreps.pdf"
rw = ReportWriter()
with open(pdfName, "w") as outFile:
     rw.ReportFormFile = "invoice.rfxml"
     rw.OutputFile = tempfile.TemporaryFile()
     # for testing
     rw.UseTestCursor = True
     rw.write(save=False)
     rw.ReportFormFile= "invoice_2.rfxml"
     rw.UseTestCursor = True
     rw.write()
     rw.OutputFile.seek(0)
     outFile.write(rw.OutputFile.read())
     outFile.close()

> 
> Thank you,
> Sibylle
> _______________________________________________

-- 
Adrian Klaver
adrian.kla...@gmail.com
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/201104161146.28759.adrian.kla...@gmail.com

Reply via email to