Custom PDF viewer How to load File

0
0

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.

Attachment
  • You must to post comments
0
0

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.

HTH

 

  • You must to post comments
0
0

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))
    f.CopyTo(ms);
this.pdfViewerAuto.PdfStream = ms;

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

Best regards
Frank

  • 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.