The following snippet is consistently throwing 'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index'
(a.FilePayload is a varbinary)
- Code: Select all
var a = await db.DocumentStore.FirstOrDefaultAsync(x => x.GUID == id);
using (Stream ms = new MemoryStream(a.FilePayload, true))
{
Document d = new Document(ms, FileFormat.Doc); <-- Exception here
MemoryStream _out = new MemoryStream();
d.SaveToStream(_out, FileFormat.PDF);
return File(_out, "application/pdf");
}
I've successfully been able to use word interop to convert this so the payload is fine, any ideas?
any help appreciated