[Flask] Report Writer

Badri badrihippo at gmail.com
Wed Nov 13 16:32:31 EST 2019


Hi,

> Interactively,
> 
> They would chose some selection criteria, I would call a module, then 
> send the pdf

Okay. Since I haven't used LaTeX much I don't have a clear idea of how 
long it'll take, but for most cases (say, plaintext + a few images) the 
compilation won't take more than a second or so. So if you can make a 
template for a LaTeX file (using the Flask/Jinja2 templating system), 
you could do something like:
Create a temporary folder (maybe using `tempfile.mkdtemp`)Write the 
LaTeX file to that (the result of render_template)Run pdflatex on that 
LaTeX file, maybe using `os.system` or a more fine-tuned commandOutput 
will be the same name with the .pdf extension: for example abc.tex will 
render to abc.pdfServe that abc.pdf file to the user.
Hope that helps. Let me know if you need more info on the tempfile 
library, since I've been working with it in one of my projects.

—Badri

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20191114/1434a76b/attachment-0001.html>


More information about the Flask mailing list