Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,366 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi to All. I need to print with xam.plugin.bluetooth package a text but the printer doesn't recognize the new line character. In graphics mode I've found the command to feed a new line but for text not. If it is possible can you give me the way to control the dimensions of the characters?
below the parser that format the text:
if (bluetooth.IsAvailable)
{
Supporto supporto1 = new Supporto();
var lista = await bluetooth.GetPairedDevices();
device = lista.FirstOrDefault(f => f.Name == supporto1.Get_Blue());
await device.Connect();
string intestaz = "AstroSmart " + supporto1.Getnome1() + " " + supporto1.Getcognome1();
string Righefile = editor1.Text;
string hh = ""; string finale = "";
int r = 0;int t=0 ; int finer = -999;
if (!device.IsWriting)
while (true)
{
while (t < Convert.ToInt16(supporto1.Get_Colonne()))
{
if (r + t >= Righefile.Count())
goto lp1;
if (Righefile[t + r] == '\n')
hh += " ";
else
hh += Righefile[t + r];
if (" \\|!\"£$%&/()=?^'[]{}#@°-.,_:;><'".Contains(Righefile[t + r]))
finer = t;
if (t == Convert.ToInt16(supporto1.Get_Colonne())-1)
{
if (finer > 0)
{
for (int ff = 0; ff < finer; ff++)
finale += Righefile[r++];
finale += "\n";
finer = -999;
}
else
{
finale += hh+"\n";
r += hh.Length;
}
hh = "";
t = 0;
break;
}
else
t++;
}
t = 0;
}
lp1:
finale += hh;
await device.Write(intestaz + Environment.NewLine+ finale);
await device.Disconnect();
}
}