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:
//********************************************************
Do i have to use something like PDFObject.js or PDF.js or is there a better way to do it?
I just can not find any good examples.
As i said i am new to web programming and web2py.
--
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think i found my own solution.Wo ever has the same Problem, try this!!!!!!!!!!!!!!!import webbrowserwebbrowser.open_new(r'file://C:\path\to\file.pdf')
It works just the way i Need it.
No it didn't work on the web.local Linux and Windows worked fine.I am using str(os.path.join(request.folder, 'tex', 'languages.tex')) to set the path to my files.I am using Massimiliano's code to start my pdf's.But i still have the 2 Problems i mentioned before.
Am Dienstag, 3. November 2015 23:31:07 UTC+1 schrieb Dave S:
On Tuesday, November 3, 2015 at 1:26:26 PM UTC-8, Karl Florian wrote:I think i found my own solution.Wo ever has the same Problem, try this!!!!!!!!!!!!!!!import webbrowserwebbrowser.open_new(r'file://C:\path\to\file.pdf')
It works just the way i Need it.
I'm glad it works for you, but it won't work on a lot of systems (Linux systems usually don't know what "C:" means, and their slashes are forward leaning).
You might look at using response.stream,
ltxfile = str(os.path.join(request.folder, 'tex', 'languages.tex'))
pdffile = str(os.path.join(request.folder, 'tex', 'languages.pdf'))
#------------------------------------
#Create and Close the TEX-File .......
#------------------------------------
os.system('pdflatex '+ltxfile) #create the PDF file
if os.path.isfile(pdffile): #remove old file from the tex directory
os.remove(pdffile)
os.rename('languages.pdf', pdffile) #move PDF file to the tex directory
import cStringIO
pdfdata = open(pdffile,"rb").read()
response.headers['Content-Type']='application/pdf'
return response.stream(cStringIO.StringIO(pdfdata), attachment=True, filename='languages.pdf')
elif form.errors:
response.flash = 'form has errors'
response.title = 'All Languages'
return dict(form=form)