0

I am using pdf.js viewer for displaying PDF files in webpage. In server side, I have a folder viewer. Inside this folder I have scripts & content folder.

In Server Scripting,

// Configuration
app.configure(function(){
app.use(express.static(__dirname + '/scripts'));
});

So if I put localhost/viewer.html to display the viewer.

To open a file I put localhost/viewer.html?file=sample.pdf. This is working fine if the viewer.html & sample.pdf are in same folder. But I want to load a input file from content folder for viewer.html in scripts folder

1 Answer 1

2

The easiest way is to set up multiple static middlewares with different root paths:

app.use('/', express.static(__dirname + '/scripts'));
app.use('/content', express.static(__dirname + '/content'));

Note that you will have to rewrite your PDF viewer to download files from http://yourhost/pdf/ instead of http://yourhost/.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.