1
Message: Header not found while trying to render stream
Question asked by vasanth - 5/25/2017 at 1:38 PM
Answered
Hi, 
 
I am receiving Header not found error message while trying to load a stream using 
public StreamResult OpenRead(string inputFile, InputOptions inputOptions)
 
The file is coming from a sharepoint server and i dont have any issue saving the file to filesystem and opening it. But when I directly load it to DocumentUltimate it gives the following error.
 
Exception: Message: Header not found
 
Please advice.
 
- Vasanth
 

2 Replies

Reply to Thread
0
vasanth Replied
I figured it out. Thank you.
0
Cem Alacayir Replied
Employee Post Marked As Answer
For future reference; probably you did not provide a file name with extension or an explicit DocumentFormat so input format could not be determined:
 
 
public class CustomDocumentHandler : IDocumentHandler
{
	public DocumentInfo GetInfo(string inputFile)
	{
            // Either provide a file name with extension  
            return new DocumentInfo(uniqueId, fileName);

            // Or specify an explicit document format if you don't have a file name
            return new DocumentInfo(uniqueId, null, DocumentFormat.Docx);
            // which can also be written as
            return new DocumentInfo(uniqueId, format: DocumentFormat.Docx);
	}

	public StreamResult OpenRead(string inputFile, InputOptions inputOptions)
	{
		return new StreamResult(stream);
	}
}
 
However we still need to display a better error message in this case.

Reply to Thread