[dba-Tech] Great JS PDF Viewer...
Jim Lawrence
accessd at shaw.ca
Thu Sep 3 19:53:41 CDT 2015
Hi Shamil:
First thing to note is that the PDF display code is just a function for a larger application. Pay attention to the universal variable that hold and are assembled the entire URL. Check how the "download_manager.js" assembles the entire PDF URL. Comment out the default assignments within the Viewer code and assign them from the application calling this code. In other words assign the Global variables within the caller routines.
Second, you could do something as simple as pass the Viewer routine, the URL via parameters. Its not classy but it is simple and it works.
Then there is HTML5's sessionStorage:
http://stackoverflow.com/questions/11609376/passing-data-between-html-pages
Jim
----- Original Message -----
From: "Salakhetdinov Shamil" <mcp2004 at mail.ru>
To: "Discussion of Hardware and Software issues" <dba-tech at databaseadvisors.com>
Sent: Thursday, September 3, 2015 12:12:30 AM
Subject: Re: [dba-Tech] Great JS PDF Viewer...
Hi Jim --
Thank you! I somehow missed to find this default .pdf file assignment.
Now, here are two challenges:
- 1. load .pdf from a url/fileName passed to the viewer.html in url parameter, e.g:
{custom site pdf viewer url}/viewer.html?pdfFile={myTestPdfFileUrl}
- 2. load .pdf via AJAX call(s) from a web service, which attributes are passed to the viewer.html would in url parameters, e.g:
{custom site pdf viewer url}/viewer.html?service={webServiceEndPointl}&pdfFileCode={guid}&...
Anybody?
Thank you.
-- Shamil
>Wednesday, September 2, 2015 6:56 PM -06:00 from Jim Lawrence <accessd at shaw.ca>:
>
>Hi Shamil:
>
>I went one step back up the directory tree to:
>
>https://github.com/mozilla/pdf.js/tree/master/web
>
>...and downloaded the ZIP file, expanded it.
>
>The directory of interest is "web" and the start html file within that directory is "viewer.html". Note: The PDF file is in that root directory and is called "compressed.tracemonkey-pldi-09.pdf" The file name is assigned to the global variable "URL", in the JavaScript file named "viewer.js" (loaded and called from the "viewer.html" file), on line 30 but it can be assigned anywhere within the html application or via a config file. See the JavaScript function file, "download_manager.js" which assembles the PDF url, for the actual downloading code.
>
>Aside: The code is really nice and should be used as reference material. :-)
>
>Jim
>
>----- Original Message -----
>From: "Salakhetdinov Shamil" < mcp2004 at mail.ru >
>To: "Discussion of Hardware and Software issues" < dba-tech at databaseadvisors.com >
>Sent: Tuesday, September 1, 2015 5:29:56 AM
>Subject: [dba-Tech] Great JS PDF Viewer...
>
> Hi All --
>
>Here is a greate JS PDF Viewer
>
>http://mozilla.github.io/pdf.js/web/viewer.html
>
>
>but I cannot find how they define the url/path to the .pdf file to be loaded/viwed, do you? - the sources are here:
>
>https://github.com/mozilla/pdf.js/tree/master/web
>
>BTW, if you try the above link ( http://mozilla.github.io/pdf.js/web/viewer.html ) on your smartphone it should also work, I suppose, as it worked on my old Nokia Lumia 800.
>
>Enjoy!
>
>
>Thank you.
>
>--
>Салахетдинов Шамиль
>_______________________________________________
>dba-Tech mailing list
>dba-Tech at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-tech
>Website: http://www.databaseadvisors.com
>
>_______________________________________________
>dba-Tech mailing list
>dba-Tech at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-tech
>Website: http://www.databaseadvisors.com
_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com
More information about the dba-Tech
mailing list