You are viewing limited content. For full access, please sign in.

Question

Question

How do I read a text file from the repository in my SDK script activity?

SDK
asked on February 13, 2015

I am using the below code to read a text file and it always returns 0 bytes for edocStream. Any idea please?

 

 using (LaserficheReadStream edocStream = document.ReadEdoc(out mimeType))
  {
                        edocStream.CopyTo(fileStream);
   }

 

0 0

Replies

replied on February 13, 2015

Unless you explicitly imported the original .txt file as the electronic file component of a Laserfiche document, .txt files are imported as the text pages of a Laserfiche document.

You can use DocumentInfo.GetPageInfos to retrieve the pages of a LF document and then read out the text for each page.

You can also use DocumentServices's DocumentExporter class to export the text of a Laserfiche document.

0 0
replied on February 13, 2015

Ok, thanks. I converted the text document as an electronic file and use the below code to read. How do I read contents of edocstream into a string object please?

 

string mimeType = "";
using (FileStream fileStream = File.Create(m_filePath))
using (LaserficheReadStream edocStream = document.ReadEdoc(out mimeType))
{
    edocStream.CopyTo(fileStream);
}

 

0 0
replied on February 13, 2015

How do you read the text associated with an electronic document please using API? The document does not have any image. It just have text. Any help is appreciated.

Thanks

Priya

 

0 0
replied on February 16, 2015

Try:

using (StreamReader reader = new StreamReader(document.ReadEdoc(out mimeType)))
{
    string s = reader.ReadToEnd();
}
0 0
replied on February 17, 2015

Thanks

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.