On Friday, April 15, 2011 03:12:56 pm Nate Lowrie wrote:
> On 4/15/11 3:02 PM, Sibylle Koczian wrote:
> > Hello,
> > 
> > after reading the documentation I thought I could get two reports in one
> > file like this:
> > 
> > pdfName = "myreps.pdf"
> > rw = ReportWriter()
> > 
> > with open(pdfName, "w") as outFile:
> >       rw.ReportFormFile = "myform_1.rfxml"
> >       rw.OutputFile = outFile
> >       # for testing
> >       rw.UseTestCursor = True
> >       rw.write(save=False)
> >       # repeat for myform_2.rfxml, at the moment left out
> > 
> > reportUtils.previewPDF(pdfName)
> > 
> > But if I try that, I get a message from Adobe Reader that the file
> > "myreps.pdf" couldn't be opened, because the file type isn't supported
> > or the file is corrupted (this is my translation of the german error
> > message). And if I omit "save=False" in the call to rw.write(), I get no
> > error message, but Adobe Reader shows an empty page.
> > 
> > All this using
> > 
> > Platform: Win
> > Python Version: 2.7.1 on win32
> > Dabo Version: Version 0.9.3; Revision ~6557
> > UI Version: 2.8.11.0 on wxMSW
> > 
> > No change with Python 2.6.6, everything else the same.
> > 
> > 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?
> 
> If you are on linux, you can generate the 2 reports as separate pdfs
> (myform_1.pdf and myform_2.pdf) with the ReportWriter and then combine
> them by running:
> 
> subprocess.Popen(["gs",  "-q",  "-sPAPERSIZE=letter", "-dNOPAUSE",
> "-dBATCH", "-sDEVICE=pdfwrite", "-sOutputFile=myform.pdf",
> "myform_1.pdf", "myform_2.pdf"])
> 
> Regards,
> 
> Nate

This should also work for other platforms if they install ghostscript.

Johnf
_______________________________________________
Post Messages to: [email protected]
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/[email protected]

Reply via email to