Assuming you have the download action in default py, then your PDF sources are accessible as
http://..../yourapp/default/download/<filename>. (here filename is the web2py assigned filename stored in the upload field). You just have to use that urls as source in the pdf.js example: <canvas id="the-canvas"><canvas> <script> jQuery(function(){ var url = '/yourapp/default/download/<filename>'; PDFJS.getDocument(url).then(function getPdfHelloWorld(pdf) { pdf.getPage(1).then(function getPageHelloWorld(page) { var scale = 1.5; var viewport = page.getViewport(scale); var canvas = document.getElementById('the-canvas'); var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; var renderContext = { canvasContext: context, viewport: viewport }; page.render(renderContext); }); }); }); </script> On Sunday, 21 June 2015 11:13:03 UTC-5, marco wrote: > > with web2py, if I have a blob field defined as follows: > > ..... > > Field('pdf','upload', uploadfield='pdf_file'), > > Field('pdf_file', 'blob') > > ..... > > How could I use PDF.js (https://github.com/mozilla/pdf.js/) to display > the file? > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.