This stream does not support seek operations
Question asked by John Gleeson - 9/14/2022 at 4:02 AM
I have followed the demo video on YouTube and got the DocumentViewerControl to run in my WebForms app. 
I have tried a few different file types and found the following
1. PDF or DOCX located on my PC both work
2. PDF located on a different machine accessed via https://myServer/xxxx/YYYY.pdf works ok
3. DOCX located on the same server accessed via https://myServer/xxxx/YYYY.docx fails and reports 'This stream does not support seek operations'

Is there any solution for this?

3 Replies

Reply to Thread
Christian Davén Replied
I have noticed the same problem. It seems that loading PDF documents into the cache from HTTP streams works fine, but if the HTTP stream must first be converted to PDF by DocumentUltimate (e.g. Word documents), it fails since HttpBaseStream.Length isn't implemented.

I would argue that this is a bug in DocumentUltimate.

A workaround is to implement a subclass of UrlFileProvider and set CanSerialize = false. This will force DocumentUltimate to first download the original document to the cache, and then convert that file into PDF, which avoids reading straight from a HTTP stream.
Cem Alacayir Replied
Employee Post
Christian's workaround is good but this will be fixed shortly.
Cem Alacayir Replied
Employee Post Marked As Answer
FYI, this issue is now fixed in Version 6.9.6 - August 27, 2023:
  • Fixed: When loading a document from URL in DocumentViewer, the below error was raised for some formats (e.g. for DOCX but not for PDF):
    'This stream does not support seek operations'
    Fixed UrlFileProvider: HttpBaseStream returned by GetStreamAsync is not seekable (members like Length and Seek throw NotSupportedException)
    so the stream should be copied to a temporary file stream and disposed.

Reply to Thread