codice:
void printDocument_PrintPage(object sender, PrintPageEventArgs e)
{
PrintDocument document = ((PrintDocument)sender);
e.HasMorePages = false;
//STAMPA LEGENDA
e.Graphics.DrawString("ELEMENTO", new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Brushes.Black, new PointF(e.PageSettings.PaperSize.Width - 800, e.PageSettings.PaperSize.Height - 1140));
e.Graphics.DrawString("DESCRIZIONE", new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Brushes.DarkRed, new PointF(e.PageSettings.PaperSize.Width - 680, e.PageSettings.PaperSize.Height - 1140));
e.Graphics.DrawString("COORDINATE", new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Brushes.Black, new PointF(e.PageSettings.PaperSize.Width - 130, e.PageSettings.PaperSize.Height - 1140));
//CICLO DI STAMPA DEI CONTENUTI
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Execution.ListaContenutiForm));
foreach (Model.Contenuto contenuto in listaContenuti)
{
//verifico che siano contenuti validi
if (!(contenuto.getNomeContenuto().Equals("Play")) && !(contenuto.getNomeContenuto().Equals("Pausa")) && !(contenuto.getNomeContenuto().Equals("Stop")))
{
coord = contenuto.getCoordinate();
this.coordinate = alfabeto[coord[1] - 1].ToString() + coord[0];
this.nomeElemento = contenuto.getNomeContenuto();
this.pathElemento = contenuto.getVideoPath();
this.descrizioneElemento = contenuto.getDescrizione();
string tipo = pathElemento.Substring(pathElemento.Length - 3, 3);
calc1 = (1100 - (i * 80));
e.Graphics.DrawString(nomeElemento, new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Brushes.Black, new PointF(e.PageSettings.PaperSize.Width - 800, e.PageSettings.PaperSize.Height - calc1));
e.Graphics.DrawString(descrizioneElemento, new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Brushes.DarkRed, new PointF(e.PageSettings.PaperSize.Width - 680, e.PageSettings.PaperSize.Height - calc1));
e.Graphics.DrawString(coordinate, new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Brushes.Black, new PointF(e.PageSettings.PaperSize.Width - 100, e.PageSettings.PaperSize.Height - calc1));
e.Graphics.DrawString(pathElemento, new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Brushes.Black, new PointF(e.PageSettings.PaperSize.Width - 800, e.PageSettings.PaperSize.Height - (1060 - (i * 80))));
i++;
}
}
}
Il classico codice per la stampa con .net.