pdfviewer loading error


This is the code used to load a pdf file into pdfviewer;

PdfViewer1.ViewerType = PdfViewerType.Auto
Dim str As Stream = files(0).InputStream
PdfViewer1.PdfStream = str

I noticed that if the file is less than 100 KB, it is loaded else it give an error about loading

  • You must to post comments

Where is files(0).InputStream coming from? If the stream is disposed or closed by the owner then you get an error, probably after the buffered data is read.

  • roni neri
    files(0).inputstream coming from the Upload control of some pdf file system file; no other actions is performed, only what you can see by my snipped code. do I have to correct something?
  • Luca (ITG)
    Yes. The streams coming from the uploading action are cleared by IIS. You have to read the files when they are uploaded, you can’t save those streams for later. You can read the file either into a temporary file or in memory and then use a memory stream.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.