Custom PDF viewer How to load File


Hi all,

here is my try for a custom pdfviewer.

I’ve integrated all stuff I need but now it’s not clear how to open file.

I have to load file from local file system (“C:\xxx.pdf” ) rather than from http url.

Thank you.

  • You must to post comments

There is one thing missing in the custom URL, change it to:

 this.ViewerURL = @"PDF\Javascript\pdfJS\web\viewer.html?file=[source]";

Then you can use the base PdfSource or PdfStream properties:

 this.PDF1.PdfSource = Application.MapPath("mousepad-color-A.pdf");

When using a custom pdf viewer the URL arguments and setup is different for each viewer. Wisej replaces [source] with the postback url. Then if you need “?file=[source]” or “/data/[source]” etc. is up to the viewer.



  • You must to post comments

Hi Davide,

you could use code like this:

string file = "C:\\...";
MemoryStream ms = new MemoryStream();
using (FileStream f = new FileStream(file, FileMode.Open, FileAccess.Read))
this.pdfViewerAuto.PdfStream = ms;

Just make sure that your App/AppPool on IIS has sufficient rights to access the local path.

Best regards

  • Davide Mercanti
    Yes i’ve read the examples… But the original wisej pdfviewer can load the document , my custom pdfviewer based on pdfjs can’t load the file
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.