Really like pdf.js, one big question i do have though, for pdf.js i provide it a file to read by doing 'viewer.html?file=http://mywebsite.com/getpdf.php'.
Is it possible to pass a query param to getpdf.php such as a record ID in the database to extract the PDF file from?
Basically would love to be able to do 'viewer.html?file=http://mywebsite.com/getpdf.php?id=1' or something similar.
URL-encode the parameter, e.g.
<?php
$url = 'viewer.html?file=' . urlencode('http://example.com/getpdf.pdf?id=1');
echo $url;
?>
or
var url = 'viewer.html?file=' + encodeURIComponent('http://example.com/getpdf.pdf?id=1');
alert(url);
... the http://example.com/getpdf.pdf?id=1 shall return valid PDF file/stream, but that's out of scope of this project (http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/uploading-files-to-mysql-database.aspx might help). Closing as answered.
Most helpful comment
URL-encode the parameter, e.g.
or