Reputation: 10395
I'm new to node/pdf js. I just install node and run pdf.js.
Now I want know how can I open pdf files using pdf js by passing pdf file url as parameter in query string?
Upvotes: 1
Views: 9302
Reputation: 39
On a further note, it is important to know that the file=document.pdf argument must come before the hash sign:
http://myserver.com/web/viewer.html?file=test.pdf#page=6&zoom=page-fit,0,540
HTH
Upvotes: 0
Reputation: 2691
Try adding ?file=document.pdf
to the viewer url. See also https://github.com/mozilla/pdf.js/issues/2496
Upvotes: 4
Reputation: 3557
It will require some changes in the viewer.js
:
parseQueryString: function pdfViewParseQueryString(query)
outside var PDFView
so it's a standalone function: function pdfViewParseQueryString(query)
PDFView.parseQueryString(..)
to pdfViewParseQueryString(..)
var DEFAULT_URL = ''
to var urlParm = pdfViewParseQueryString(document.location.search.substring(1)); var DEFAULT_URL = urlParm.url;
$("actualViewer").src = 'pdfViewer?url=' + encodeURIComponent(pathToFile);
Upvotes: 1