question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I need to be able to define DEFAULT_URL via a php script. My script is based on viewer.html, but it gets a filename from a database with an ID, and defines that in the header:

echo "var DEFAULT_URL = '".$file."'";

This doesn’t seem to be working for me in 2.0 - how would I go about defining DEFAULT_URL now? Exposing the location of the pdf file in the URL is simply not an option for me, nor is defining it in the viewer.js file.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Snuffleupaguscommented, Jun 14, 2018

As explained in the FAQ there’s another, and possibly even easier, way to achieve this; please see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#file

To summarize: Load the viewer with an empty ?file= parameter, as in e.g. https://mozilla.github.io/pdf.js/web/viewer.html?file=, and then call PDFViewerApplication.open(/* file here */) to load the PDF file.

0reactions
prohtexcommented, Jun 15, 2018

@Snuffleupagus I tried placing this code in the header of viewer.html:

PDFViewerApplication.open('<?=$file;?>');

And I get this error:

Can't find variable: PDFViewerApplication

Read more comments on GitHub >

github_iconTop Results From Across the Web

FormsAuthentication.DefaultUrl Property (System.Web.Security)
The DefaultUrl property value is set in the configuration file for an ASP.NET application by using the defaultUrl attribute of the forms configuration ......
Read more >
defaultUrl, loginUrl in ASP.NET web.config - Stack Overflow
DefaultUrl defines where the authentication process will take you after login. Basically user tries to access Default.aspx.
Read more >
Understand Default URL Pattern - Contentstack
The Default URL Pattern feature lets you set a common URL pattern for all the entries of a content type. Once you set...
Read more >
default-url - IBM
The default-url command specifies the URL fragment on the application server to go to after a successful login. The field is only used...
Read more >
Default URL - Shrine
The default_url plugin allows setting the URL which will be returned when there is no attached file. ... The default URL block is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found