hello all .
i was asked to make a program which takes the forms picture and then prints it. the form can be of any size and also there must be two modes for printing , a batch print option and a single printing option .
printing the form was easy but im stuck at the printing section .
my problems are :
1.i dont know how i can change the size of the card when printing.!
2.i have no idea how i can have a batch printing without the user interference!
so far i have these functions for printing procedures :
protected void btnPrint_Click(object sender, EventArgs e)
PaperSize cardsize = new PaperSize("test", this.Width, this.Height);
PrintDocument pd = new PrintDocument();
;pd.PrinterSettings.Duplex = Duplex.Horizontal;
PageSettings psetting = new PageSettings();
psetting.PaperSize = cardsize;
pd.DefaultPageSettings = psetting;
pd.PrintPage += new PrintPageEventHandler(PrintImage);
this print function is located in a timer tick event , inwhich the forms information is updated each X seconds and when updated , it is printed and its goes on and on till there are no more information to be updated and hence printed .
void PrintImage(object o, PrintPageEventArgs e)
int x = SystemInformation.WorkingArea.X;
int y = SystemInformation.WorkingArea.Y;
int width = this.Width;
int height = this.Height;
Rectangle bounds = new Rectangle(x, y, width, height);
Bitmap img = new Bitmap(width, height);
Point p = new Point(100, 100);
As you can see i tried to re-size the print (sketch ) to match the the form size (which is what is actually to be printed) but no luck!
i have no idea how im supposed to do that! i searched dozens of articles on google on printing! but none of them were useful to me and neither they covered what i was looking after
and the other problem is that , when printing , a window is shown to the user to choose a name and then save the print file !( i currently have no printer installed , so there is only the Microsoft's default (virtual?) printer ! - i dont know if this is shown because of that virtual printer or there is the wrong way for batch printing )
i would be very thankful if any of you guys guide me get through this problem
thank you all in advance