[CentralOH] Opening Adobe Reader from Python
mark at microenh.com
Wed Sep 29 17:17:59 CEST 2010
My application creates PDF output using the reportlab library. Once the file has been created, I would like to use a PDF viewer to open view the PDF file. Ideally, I would like to not clutter the disk with a bunch of temporary files.
Reportlab can generate it's output in memory if you use the StringIO object.
On the Mac, the default PDF viewer can get it's input from stdin so the PDF can be piped to it.
On Windows, the standard PDF viewer for most people is Adobe Reader. It doesn't seem like it can get it's PDF from stdin and the only way I have found to pass data to is is via a file. I can create a temporary file using tempfile, but deleting that file is problematic. If I allow tempfile.NamedTemporaryFile to automatically delete the file, Adobe Reader can't find the file. If I try to delete the file from my python program after launching Adobe Reader, but while Adobe Reader is still open, the file is in use by another process and can't be deleted.
I know Adobe Reader can be opened to view temporary PDF files from the internet. I wonder what mechanism it is using?
More information about the CentralOH