I have some code that is used to programmatically create a Document to send to the printer. It goes something like this:
private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs ev)
{
ev.Graphics.DrawImage(pictureBox1.Image, 50, 100);
string drawToday="Date : "+strToday;
string drawPolicyNo="Policy # : " + strPolicyNo;
string drawUser="User : " + strUser;
Font drawFont=new Font("Arial",30);
SolidBrush drawBrush=new SolidBrush(Color.Black);
PointF drawPointToday=new Point(50,400);
PointF drawPointPolicyNo=new Point(50,450);
PointF drawPointUser=new Point(50,500);
ev.Graphics.DrawString(drawToday,drawFont,drawBrush,drawPointToday);
ev.Graphics.DrawString(drawPolicyNo,drawFont,drawBrush,drawPointPolicyNo);
ev.Graphics.DrawString(drawUser,drawFont,drawBrush,drawPointUser);
}
Its effective code, but now I need to do the same procedure but instead write it to an image file so that it can be sent to a browser and printed from there. It should be relatively simple to reuse this code, but I am getting hung up, unfortunately, on what drawing surface to use in replacement of the PrintPageEventArgument.
Thanks
Edit: THanks I get that I just need another Graphics object, but the Graphics object by itself does not have a public constructor, so what I am looking for is a suggestion on what object I need to substatiate to be able to create a Graphics object to draw on. I thought perhaps bitmap? Bitmaps are of course pixel based instead of point based so I was not sure that this is the best medium to use.