想在PS中先做好要打印的图片模板,再在winform中调用并写上相应的数据。
请问如果用A4纸打印全屏的话,在PS中的图片大小应该要设置多少,
我看网上说72分辨率的尺寸的图像像素是595×842?
我在PS中新建这样画布后发现貌似有点小,用12号字写不了多少字。是哪里设置错误?
请教,谢谢大家。

解决方案 »

  1.   

    打印最后用210*297mm
    如果你非要用像素,你糊略了一个东西,就是分辩率,分辩率越大,你在a4中打印的象素就越多,所以划定a4纸的不是像素,而是尺寸。
      

  2.   

    现在我已经在自己的打印机上调好了位置,打印出来的东西算正常。
    可发到客户那边,他试了两台电脑和打印机,打印出来的文字及LOGO都非常的大。是因为分辨率的问题吗?
    问:
    1、如何在程序中定义打印的分辨率(DPI),以下的代码在客户那边还是不正常,是因为分辨率设置的太大?PrintDocument pd = new PrintDocument();
    PrinterSettings ps = new PrinterSettings();
                ps.DefaultPageSettings.PrinterResolution.X = 600;
                ps.DefaultPageSettings.PrinterResolution.Y = 1200;
                ps.DefaultPageSettings.PrinterResolution.Kind = PrinterResolutionKind.Custom;
     pd.DefaultPageSettings.PrinterSettings = ps;2、一般的分辨率要怎么设置,设置多大的呢?
      

  3.   

    由于打印机的分辨率不同,所以绘图的时候,使用像素单位会造成大小差异,应该使用设备无关的坐标单位:
    以下代码使用 1/300 英寸,因此所有绘图的坐标都要重新换算了。
    public override void Paint(Graphics g)
    {
        g.PageUnit = GraphicsUnit.Document
    }
      

  4.   

    我是在PS里面算好某个字在哪个x/y坐标上,然后写到程序中,如下:
    g.DrawString(tbxCustomeName.Text, f, b, 156, 288);
    如按你所说的使用英寸的话,这样的坐标是要怎么更改,谢谢。
      

  5.   

    我使用的代码是http://developer.51cto.com/art/200908/146983.htm 这上面的
      

  6.   

    你是先生成图片,再打印图片的,所以只要在打印图片的地方换算一下:
    int x = e.MarginBounds.X;
    int y = e.MarginBounds.Y;
    int width = temp.Width;
    int height = temp.Height;
    Rectangle destRect = new Rectangle(x, y, width, height);              e.Graphics.DrawImage(temp, destRect, 0, 0, temp.Width, temp.Height, System.Drawing.GraphicsUnit.Pixel);  
    上面代码中的 Pixel,可以换成其它值,如:Display, Document, Millimeter, Point, Inch, 然后 destRect 作相应换算
      

  7.   

    谢谢回复
    System.Drawing.GraphicsUnit.Pixel我把这个属性值改成Document, Millimeter, Point, Inch时都会报“用户代码未处理 未实现”的错误提示。-_-...
      

  8.   

    我记得是获取当前使用打印机的分辨率然后再设置到你的graphics上的。
    很久之前弄的。忘的差不多了。
      

  9.   

    如果先获取当前分辨率再进行设置文字的位置,那工作量不是很大?而且也没有那么多的打印机进行测试。有哪位能告知如何用Display, Document, Millimeter, Point, Inch等设置吗?谢谢了。
      

  10.   

    又有一个被打印所困的人。以下代码设定打印为 毫米。 e.Graphics.PageUnit = GraphicsUnit.Millimeter;这个就与设备无关了。
      

  11.   

    我使用以下的代码,打印预览时提示“未实现”的错误
     private void pd_PrintPage(object sender, PrintPageEventArgs e)
            {
    GraphicsUnit units = GraphicsUnit.Millimeter;
     Image temp = Image.FromFile(Application.StartupPath + @"\images\temp.jpg");
     GetResultIntoImage(ref temp, "1231", flowId, date, baseExpense, fine, upExpense, actualExpense, chineseExpense, payDate, adminId);
                int x = e.MarginBounds.X;
                int y = e.MarginBounds.Y;
                int width = temp.Width;
                int height = temp.Height;            Rectangle destRect = new Rectangle(x, y, width, height);
                e.Graphics.DrawImage(temp, destRect, 0, 0, temp.Width, temp.Height, units);}只有设置为 GraphicsUnit.Pixel才不会出错,其余的都是提示“未实现“的错误提示。
    方便的话能否加我Q?315249490 谢谢
      

  12.   

    GraphicsUnit units = GraphicsUnit.Millimeter;======> e.Graphics.PageUnit = GraphicsUnit.Millimeter;就正确了。
      

  13.   


    float x=纸宽(mm);
    float y=纸高(mm);e.Graphics.DrawImage(temp,x,y);