I
ISMAILRAJPUT
Every thing is working fine but when the print command is sent to printer
and you check the size of the file , it gives normally 5 to 6 mb per image .
But in orginal pictures are normally 200 to 300 KB.
You will see i am resizing the picture to fit in landscape area , i think
this is multiplying the size of data .
How do i compress it?
here is the code
private void menuItem1_Click(object sender, System.EventArgs e)
{
if (listView1.SelectedItems.Count > 0 )
{
try
{
// Assumes the default printer.
System.Windows.Forms.PrintPreviewDialog ppd = new PrintPreviewDialog();
System.Drawing.Printing.PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.DefaultPageSettings.Landscape = true;
ppd.Document = pd ;
ppd.Show();
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
}
catch (Exception exp )
{
MessageBox.Show( exp.ToString(),"An error occurred while printing");
}
}
}
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw a picture.
ev.Graphics.DrawImage(Bitmap.FromFile(listView1.SelectedItems[0].Text.ToStri
ng()),10,10,1135,800);
// Indicate that this is the last page to print.
ev.HasMorePages = false;
}
and you check the size of the file , it gives normally 5 to 6 mb per image .
But in orginal pictures are normally 200 to 300 KB.
You will see i am resizing the picture to fit in landscape area , i think
this is multiplying the size of data .
How do i compress it?
here is the code
private void menuItem1_Click(object sender, System.EventArgs e)
{
if (listView1.SelectedItems.Count > 0 )
{
try
{
// Assumes the default printer.
System.Windows.Forms.PrintPreviewDialog ppd = new PrintPreviewDialog();
System.Drawing.Printing.PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.DefaultPageSettings.Landscape = true;
ppd.Document = pd ;
ppd.Show();
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
}
catch (Exception exp )
{
MessageBox.Show( exp.ToString(),"An error occurred while printing");
}
}
}
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw a picture.
ev.Graphics.DrawImage(Bitmap.FromFile(listView1.SelectedItems[0].Text.ToStri
ng()),10,10,1135,800);
// Indicate that this is the last page to print.
ev.HasMorePages = false;
}