I wrote the entire program that generates an x9.37 ICL file. The only issue I am having is on the image data part of the record 52. When I validate using the x9 Validator tool and bunch of others, the ICL file breaks on the record 52 on field 19. It is unable to recreate the image form the binary string. If I remove the check information and just try to send an empty file, it goes through without any issues. It is able to correctly read all records and fields from 01 > 10 > 20 > 25 > 50 > 52 > 70 > 90 > 99. I just don't know why it doesn't work with the image when it is formated correctly (240dpi, B&W Group IV Tiff, and is less than 200kb file size).
The code snippet I am using to convert the image to binary string is as follows:
public static string ConvertImage(Image image)
{
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, ImageFormat.Tiff);
byte[] imageBytes = ms.ToArray();
string encodedString = Encoding.Default.GetString(imageBytes);
}
return encodedString;
}
I am not sure where I am messing up. Greatly appreciate any feedback. Thanks.