I use this http://www.codeproject.com/Articles/31944/Implementing-a-TextReader-to-extract-various-files and basically works.
I wrote this test to check if a filter will read as expected from an array of bytes.
private const string ExpectedText = "This is a test!";
[Test]
public void FilterReader_RtfBytes_TextMatch()
{
var bytes = File.ReadAllBytes(@"Test Documents\DocTest.rtf");
var reader = new FilterReader(bytes, ".rtf");
reader.Init();
var actualText = reader.ReadToEnd();
StringAssert.Contains(ExpectedText, actualText);
}
Test failed with ErrorCode: FILTER_E_ACCESS , it works fine when I give it a file name.
new FilterReader(@"Test Documents\DocTest.rtf", ".rtf"); <-- works
I am puzzled why this is so. I looked through the code and it seems that the dll rtf filter returns an error. What is even more puzzling.
It works great for other file types, for example; .doc, .docx, .pdf
source
share