Well come on... in my case I did printing on a matrix printer.. best way I found was using String Bilder..
Print code
private void PrencherArquivo(DataTable dt, NotaFiscal item, ClienteAG cliente)
{
StringBuilder sb = new StringBuilder();
sb.Append(((char)27).ToString()).Append("C").AppendLine(((char)18).ToString());
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
for (int i = 1; i <= item.volqte; i++)
{
sb.AppendLine(cliente.nome);
sb.AppendLine("");
sb.AppendLine(cliente.logradouro + "-" + cliente.numeroendereco);
sb.AppendLine(cliente.bairro + "-" + cliente.mun_ufd_sigla);
sb.AppendLine("CEP:" + cliente.cep);
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine(item.numero + " " + item.volpeso.ToString("N1"));
sb.AppendLine("");
sb.AppendLine(" VOLUME " + i + " DE " + item.volqte);
if (item.volqte > i)
{
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
}
else
{
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine("");
}
}
sb.Append(((char)27).ToString()).AppendLine("@");
RawPrinterHelper.SendStringToPrinter("EPSON LX-300+ /II", sb.ToString());
}
Print code.
public static bool SendStringToPrinter(string szPrinterName, string szString)
{
IntPtr pBytes;
Int32 dwCount;
// How many characters are in the string?
dwCount = szString.Length;
// Assume that the printer is expecting ANSI text, and then convert
// the string to ANSI text.
pBytes = Marshal.StringToCoTaskMemAnsi(szString);
// Send the converted ANSI string to the printer.
SendBytesToPrinter(szPrinterName, pBytes, dwCount);
Marshal.FreeCoTaskMem(pBytes);
return true;
}
It would be interesting to post part of the code you have already done, so we can indicate based on this the best solution to your problem.
– Ismael
Make sure this post doesn’t suit you (if you haven’t seen it already). http://answall.com/questions/43561/imprimir-relat%C3%B3rio-do-reportviewer-diretamente-sem-pr%C3%A9-visualiza%C3%A7%C3%A3o and please edit your question by adding the code you posted as a comment.
– Ismael
Opa Ismael thanks for the attention, but I’ve seen this post yes and it hasn’t helped me yet...
– Junior Guerreiro