打印页面时出现问题 [英] problem occrur in printing of pages
问题描述
使用"Send To Notebook 2007"和某些Hp打印机可以打印图像.
.但是在使用Microsoft Xp Document Viewer和Hp Deskjet F4200 series打印时,图像会被压缩或为实际图像大小的1/4.
打印代码图像如下.它可以在某些打印机上正常工作,而不能与Hp f4200 sieris一起工作.
我发现的问题:
1.在使用Send Notebook 2007进行DPIX& DPIY值为300.
2.在使用Microsoft Xp Document和Hp F4200打印时,DPIX和DPIY值为600.我要减小Dpix nad DPiy值.请帮帮我.
Printing image is fine with " Send To Notebook 2007 " and some printer of Hp
. But while printing with Microsoft Xp Document viewer and Hp Deskjet F4200 series Image get compresseed or 1/4 Of real image size.
Code Of printing Image is below. It works fine with Some Printer and not work with Hp f4200 sieris.
Problem what i Found:
1. while priniting with Send Notebook 2007 the DPIX & DPIY value is 300.
2. while printing with Microsoft Xp Document and Hp F4200 The DPIX and DPIY value is 600. I want reduce Dpix nad DPiy value,. Please Help me .
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
try
{
if (dataGridView1.Rows.Count > 1)
{
try
{
System.Drawing.Font font = new System.Drawing.Font("Arial", 10);
e.Graphics.PageUnit = GraphicsUnit.Pixel;
e.Graphics.PageScale = 1.0F; ;
float x = e.MarginBounds.Left;
float y = e.MarginBounds.Top;
e.Graphics.TextContrast = 5;
e.Graphics.Clear(System.Drawing.Color.White);
e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
if (pageindex < 5)
{
e.Graphics.DrawImage(finalimage[pageindex], Convert.ToInt32(numericUpDown14.Value), Convert.ToInt32(numericUpDown13.Value),finalimage[pageindex].Width, finalimage[pageindex].Height);
pageindex++;
e.HasMorePages = (pageindex < 5);
}
}
catch
{
}
}
else
{
System.Drawing.Font font = new System.Drawing.Font("Arial", 10);
float x = e.MarginBounds.Left;
float y = e.MarginBounds.Top;
e.Graphics.DrawImage(pictureBox2.Image, 200, 250);
}
}
catch
{
}
}
[edit]已添加代码块-OriginalGriff [/edit]
[edit]Code block added - OriginalGriff[/edit]
推荐答案
可能,您的问题是单位选择:
Probably, your problem is your unit selection:
e.Graphics.PageUnit = GraphicsUnit.Pixel;
由于像素的大小将取决于设备的输出分辨率,因此我希望大小会在设备之间发生变化.尝试改用设备独立单位:尝试改用点",英寸",文档"或毫米"-随便哪个.
Since the size of a pixel will be dependant on the output resolution of the device, I would expect the size to change between devices. Try using a device independant unit instead: try Point, Inch, Document or Millimeter instead - whichever you are comfortable with.
这篇关于打印页面时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!