Witam.
Próbuję wydrukować coś na kartce formatu A5 w poziomie.
Wyklepałem coś takiego:
private void Print()
{
PrintDocument printDocument1 = new PrintDocument();
var paperSize = printDocument1.PrinterSettings.PaperSizes.Cast<PaperSize>().FirstOrDefault(e => e.PaperName == "A5");
printDocument1.PrinterSettings.DefaultPageSettings.PaperSize = paperSize;
printDocument1.PrinterSettings.DefaultPageSettings.Landscape = true;
printDocument1.PrintPage += printDocument1_PrintPage;
printDocument1.Print();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Color.Black, (float)0.2), new Rectangle(5, 5, 500, 60));
e.Graphics.DrawString("TEST WYDRUKU", new Font("Tahoma", 13, FontStyle.Bold), new SolidBrush(Color.Black), new Rectangle(5, 10, 500, 50));
}
Jednak wydruk jest na A4 i w pionie (przykładowy z drukarki PDF w załączniku).
Pytanie standardowe: co zrobiłem źle?