[reportlab-users] display report without writing to disk

Uwe C. Schroeder reportlab-users@reportlab.com
Sat, 9 Oct 2004 23:33:55 -0700


=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


That's what I'm using. Should work for any unix and windows - don't know ab=
out=20
Mac though.

        if sys.platform[:3] =3D=3D 'win':
            # windows launch
            try:
                os.startfile(_tmppath)
            except:
                traceback.print_exc()

        elif sys.platform[:5] =3D=3D 'linux':
            # linux launch
            if os.fork() =3D=3D 0:      =20
                os.execlp(_tmpapp,_tmpapp,_tmppath) =20

_tmpapp is determined by using the file magic (mimetype) and my program has=
 a=20
setup where I can set which application to use for which mimetype. _tmppath=
=20
is the document to view. There are many ways to find the mimetype, so you'd=
=20
have to read the python libs documentation or AFAICT there is a wx.MimeType=
=20
class too.

hope that helps

UC



On Saturday 09 October 2004 11:26 pm, Tim Smith wrote:
> cheers, is there a cross platform way i can call apps like this?
>
> Uwe C. Schroeder wrote:
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >On Saturday 09 October 2004 09:40 pm, Tim Smith wrote:
> >>Tim Roberts wrote:
> >>>On Thu, 07 Oct 2004 09:36:56 +1000, Tim Smith <tims@cqpl.com.au> wrote:
> >>>>is there a way to just display my report before writing it to file?
> >>>>i'd be using wxpython as my gui.
> >>>
> >>>Not easily.  You could probably pipe it into GhostScript, but it's a
> >>>lot easier to write it to a file and automatically invoke the Acrobat
> >>>Reader.  I use Acrobat as my "print preview".
> >>>
> >>>The only downside is that Acrobat keeps the file open while it is
> >>>being displayed, so you cannot overwrite it.  You have to close the
> >>>document before each run.
> >>
> >>can you give me an example of how you call acrobat?
> >
> >on win32 just use
> >
> >os.startfile(filename)
> >
> >This call will use the OS registrated application for that filetype.
> >Win usually determines the filetype by extension, so if you create a
> > temporary file make sure it has the right extension (.pdf)
> >
> >	UC
> >
> >- --
> >Open Source Solutions 4U, LLC	2570 Fleetwood Drive
> >Phone:  +1 650 872 2425		San Bruno, CA 94066
> >Cell:   +1 650 302 2405		United States
> >Fax:    +1 650 872 2417
> >-----BEGIN PGP SIGNATURE-----
> >Version: GnuPG v1.2.3 (GNU/Linux)
> >
> >iD8DBQFBaNGHjqGXBvRToM4RArt3AJ4rqzj7ed2yQBVnZF4KMoW7xN9aqgCfeyuf
> >RV6j+SQ7f5/7EuVfxOi3Eks=3D
> >=3Dj/rT
> >-----END PGP SIGNATURE-----
> >
> >_______________________________________________
> >reportlab-users mailing list
> >reportlab-users@reportlab.com
> >http://two.pairlist.net/mailman/listinfo/reportlab-users
>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users@reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users

=2D --=20
	UC

=2D --
Open Source Solutions 4U, LLC	2570 Fleetwood Drive
Phone:  +1 650 872 2425		San Bruno, CA 94066
Cell:   +1 650 302 2405		United States
=46ax:    +1 650 872 2417
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFBaNfTjqGXBvRToM4RAsw1AJ0cEGkx6kyY54HIghutJNE2zPGEmACdELVo
HdKsfcyu8oqB1pRIgNmhqBc=3D
=3D+qHT
=2D----END PGP SIGNATURE-----