Using Companalytics.X9 library to read X9 file

I have been tasked with automating in an X9 reader app. However, I also found a library that appears to allow directly parsing these files.

There is example code:

string path = @"C:\Temp\sample.x9";
string imageOutDir = @"C:\Temp\SampleCheckImages";
using (Stream x9File = File.OpenRead(path))
using (X9Reader reader = new X9Reader(x9File))
{
    doc = reader.ReadX9Document();
    reader.WriteImagesToDisk(imageOutDir);
}

How would I translate this into an Invoke Code?

Anyone have any advice on this?

For anyone who finds this later, I discovered that the issue is because the files we are receiving are in X9.37 format, while the Companalytics library is for X9.100-187 file formats.

1 Like