can someone help me.
I try to print a report but i have some promblem when formatting header and pages.
This is an example:
The ID to display are 39.
I’d like to have a multiple pages print and header on each page.
this is my code now:
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
string IMAGE = "";
sqlite.Open(); //Initiate connection to the db
string stm = "SELECT VALORE FROM IMPOSTAZIONI WHERE IMPOSTAZIONE = 'LOGO';";
using var cmd = new SQLiteCommand(stm, sqlite);
using SQLiteDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
IMAGE = (string)rdr["VALORE"];
}
sqlite.Close();
Image bgFront = Image.FromFile(@"Immagini\" + IMAGE);
e.Graphics.DrawImage(bgFront, 50, 0, 100, 100);
e.Graphics.DrawString("Report Movimenti in Uscita non Pagati", new Font("Courier New", 18, FontStyle.Bold), Brushes.Black, new PointF(210, 40));
e.Graphics.DrawString(richTextBox1.Text, new Font("Courier New", 14, FontStyle.Bold), Brushes.Black, new PointF(50, 150));
}
private void button1_Click(object sender, EventArgs e)
{
if (printPreviewDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.DefaultPageSettings.Landscape = true;
printDocument1.Print();
}
}
private void printPreviewDialog1_Load(object sender, EventArgs e)
{
printDocument1.DefaultPageSettings.Landscape = true;
}
Can you help me format this report correctly?
I’d like to have a multiple pages print and header on each page.