Page 1 of 1

Export to EPS file corrupted with Unicode data

Posted: Tue Jul 11, 2006 6:33 am
by 9640311
I have TeeChart .NET Build 2.0.2306.26232 and I'm attempting to export to an EPS file. However, the exported file looks like it's corrupted. Upon further inspection, it appears that the data section of the EPS file is in Unicode UTF-16 format. However, it probably should just be regular ASCII (or maybe UTF-8 w/o the BOM is ok? Not sure on what standards apply here). I'm using GhostScript (GhostView) to open the file.

Posted: Tue Jul 11, 2006 8:21 am
by narcis
Hi stratadat ,

This is a known issue (TF02011180) already listed on our defect list to be fixed for future releases. In the meantime you can use the workaround one customer suggested:

Code: Select all

string filename = "OKEPS.EPS";
 Memory Stream ms = new MemoryStream();
 tChart1.Export.Image.EPS.Save(ms);
 ms.Seek(0, SeekOrigin.Begin);
 FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite);
 while(true) {
 int x = ms.ReadByte();
 if (x < 0) break;
 if (x == 0x00 || x == 0xFF || x == 0xFE) continue; // <-- this is the point. I remove the char - 0x00, 0xFF, 0xFE
 fs.WriteByte(Convert.ToByte(x));
 }
 fs.Close();
 ms.Close();