stampa etichetta (in A4 e su pdf...) ma la stampa!!! ora va testata conf della printer etichette e ci siamo...

This commit is contained in:
Samuele Locatelli
2014-06-12 19:17:25 +02:00
parent a66235472d
commit 22d8eaa273
14 changed files with 36 additions and 56 deletions
+16 -30
View File
@@ -7,6 +7,7 @@ using System.Drawing.Printing;
using System.Windows.Forms;
using SteamWare;
using GMW_data;
using System.Drawing;
namespace GMW_data
@@ -16,40 +17,25 @@ namespace GMW_data
/// </summary>
public class bCodePrinter
{
/// <summary>
/// Handler per PrintPageEvents
/// </summary>
/// <param name="sender"></param>
/// <param name="ev"></param>
private void PrintPage(object sender, PrintPageEventArgs ev)
{
#if false
Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]);
ev.Graphics.DrawImage(pageImage, ev.PageBounds);
m_currentPageIndex++;
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
#endif
}
/// <summary>
/// funzione di stampa...
/// </summary>
private void Print(string printerName)
public void Print(string printerName, PaperSize pSize, string testo)
{
#if false
//const string printerName = "Microsoft Office Document Image Writer";
//const string printerName = "Brother HL-2170W series";
if (m_streams == null || m_streams.Count == 0)
return;
PrintDocument printDoc = new PrintDocument();
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
logger.lg.scriviLog(String.Format("Impostazioni non valide per la stampante \"{0}\".", printerName), tipoLog.ERROR);
return;
}
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
printDoc.Print();
#endif
tex2print = testo;
PrintDocument label = new PrintDocument();
label.DefaultPageSettings.PaperSize = pSize;
label.PrinterSettings.PrinterName = printerName;
label.PrinterSettings.DefaultPageSettings.PaperSize = pSize;
label.PrintPage += new PrintPageEventHandler(PrintPage);
label.Print();
}
public string tex2print { get; set; }
private void PrintPage(object sender, PrintPageEventArgs e)
{
SolidBrush brush = new SolidBrush(Color.Black);
Font threeOfNine = new Font("Free 3 of 9 Extended", 40, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
e.Graphics.DrawString("*" + tex2print + "*", threeOfNine, brush, 20, 20);
}
/// <summary>
/// oggetto protected