Since 2015.2 using escape codes with the dot matrix output doesn't work as before anymore.
The test below passes in 2015.1, but fails in 2015.2.
The text is "<#double>TEXT<#/double>" <#double> and <#/double> should translate to the appropriate ESC codes as defined in a custom StiEscapeCodesCollection.
Please note, that even 2015.1 is doing it wrong, because it adds a space after the <#/double> in the output.
In 2015.2 the <#/double> gets translated to EF-BB-BC-E2-80-8E in the output.
This only happens, if the text ends in an escape code. With a text like "<#double>TEXT<#/double>xxx" it works perfectly fine - no extra space, no gibberish.
Code: Select all
[Test]
public void Bug_with_reports_net_2015_02()
{
var report = new StiReport();
var stiPage = report.Pages[0];
stiPage.Components.Add(new StiText(new RectangleD(0, 0, stiPage.Width, stiPage.PageHeight), "<#double>TEXT<#/double>"));
var stiEscapeCodesCollection = new StiEscapeCodesCollection {{"double", "\x1d" + "!\x11"}, {"/double", "\x1d" + "!\x00"}};
stiEscapeCodesCollection.Name = "EPSON";
StiOptions.Export.Txt.EscapeCodesCollectionList.Add(stiEscapeCodesCollection);
report.Render();
var output = StiDotMatrixPrintProvider.GetReportForDotMatrixReport(report, Encoding.UTF8, false, StiTxtBorderType.Simple, false, false, false, true, 1f, 0.85f, StiPagesRange.All, true, "EPSON");
Assert.That(output, Is.EqualTo("\x001d!\x0011TEXT\x001d!\x0000 \r\n"));
}