Try this way to display your pdf:
def yourcontroller()
# generate pdf
. . .
import cStringIO
data = open(filename,"rb").read()
response.headers['Content-Type']='application/pdf'
return response.stream(cStringIO.StringIO(data))
On Mon, Nov 2, 2015 at 4:29 PM, Karl Florian <[email protected]>
wrote:
> Hi,
> i am a newby to web2py and need some help dislaying label in my
> application.
>
> I’m using Latex and PSTricks to create my barcode label.pdf files.
> The problem is, everthing works ok on local Windows or Ubuntu but not from
> my Linux-VServer (WEbServer).
> The label.pdf is created but not displayed.
>
> This my sourccode after the place where i creating my label.pdf file:
> //********************************************************
> This does not work on webserver (only in local Systems):
> ...............
> os.system('latex label.tex')
> time.sleep(0.1)
> if sys.platform == "win32":
> os.system('dvips -o label-pics.ps label.dvi')
> os.system('ps2pdf awblabel-pics.ps label.pdf')
> os.startfile('label.pdf')
> else:
> # os.system('dvipdf label.dvi')
> os.system('dvips -o awblabel-pics.ps label.dvi')
> os.system('ps2pdf awblabel-pics.ps label.pdf')
> if sys.platform == "darwin": subprocess.call(['open',
> 'label.pdf'])
> else: subprocess.call(['xdg-open', 'label.pdf'])
> return dict(redirect(URL('labelapp', args=req_id)))
>
> //********************************************************
> This works, however my SUBMIT Button does not get released:
> ...................
> else:
> mypdffile=os.path.join(request.folder, 'pdffiles', 'label.pdf' )
> pdfdata = open(mypdffile,"rb").read()
> os.unlink(mypdffile)
> response.headers['Content-Type']='application/pdf'
> return pdfdata
> return dict(redirect(URL('labelapp', args=req_id)))
>
> //********************************************************
>
> Do i have to use something like *PDFObject.js* or *PDF.js* or is there a
> better way to do it?
> Where can i find examples that use *PDFObject.js* or *PDF.js*?
> .........................
>
> I just can not find any good examples.
>
> As i said i am new to web programming and web2py.
>
>
> I think web2py is a cool product.
> Hope someone can help.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Massimiliano
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.