Forum OpenACS Q&A: Response to More control of output

Posted by Tilmann Singer on
Jade, I am calling ReportLab with exec to pregenerate pdf's in the background whenever the underlying data changes. If for some reason a pdf is requested that has not been pregenerated previously then the request triggers the exec call. Even when the pdf is generated during the request this way it works quite fast - a few seconds - which is acceptable IMHO.

The data is exchanged via a temporary xml file: previously to calling exec the tcl script writes the data in an xml file in /tmp/ and then calls the ReportLab script giving it the filename on the commandline. The ReportLab script then parses the xml and generates the pdf. This sounds a bit complicated - I tried first to pass the data via stdin, but could not make it work with non us-ascii characters (umlauts always showed up as weird two-char combinations).

No need for scary dynamically generated scripts here - actually I am not sure what you meant by that?

Running python and ReportLab from inside aolserver would  be much more efficient I guess, but for now the approach above works fine.

You can check out a demo of that setup here: - an online business card generator.