private void printDocument_PrintPage1(object sender, PrintPageEventArgs e)
{
//Info width = 827
//Info height = 1169
int mx = e.MarginBounds.Left;
var font = new Font(Font.FontFamily, 20);
var fontColor = new SolidBrush(Color.Black);
//drawing lines for now
int pageheight = e.MarginBounds.Height;
float right = e.PageBounds.Width - 172 - mx;
float left = e.PageBounds.Width/2 + mx;
float yline = e.MarginBounds.Top;
int linediff = pageheight/4;
for (; _codecount < Files.Count; _codecount++)
{
float qrImageX, qrTextX;
string text = Files[_codecount].Text;
text = text.Substring(0, text.Length - 5);
if (yline + linediff > e.MarginBounds.Bottom)
{
e.HasMorePages = true;
return;
}
Image code = QrCodeGenerator.GenerateCode(text);
//Even on left. Odd on right
if (_codecount%2 == 0)
{
qrImageX = mx;
qrTextX = left;
}
else
{
qrImageX = right;
qrTextX = mx;
}
e.Graphics.DrawString(text, font, fontColor, new RectangleF(qrTextX, ((int) yline + 90), 500, 100));
e.Graphics.DrawImage(code, qrImageX, (float) ((int) yline + 34.5));
yline += linediff;
}
e.HasMorePages = false;
}