none
print jpeg and Resolution 838 x 1169 ?

    שאלה

  • Hello

    I print with below code.

    I set realution 300 DPI. and pixels 838 with and 1169 pixel height at photoshop. page size is 7.1 cm widht and 9.9 cm height at photoshop. when i print, picture size is one A4. picture fit for A4.

    At photoshop if i set 2480 pixel widht and 3507 pixel height, paper size is an A4 (21 cm width and 30 cm height.) But problem is when i print page, it is so huge even size is A4. How can i use 2480 pixel widht and 3507 pixel height for one A4 picture pringting ?

    private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
            {
                //PrinterResolution pr = new PrinterResolution();
    
                //pr.X = (int)img.HorizontalResolution;
    
                //pr.Y = (int)img.VerticalResolution;
    
                //e.PageSettings.PrinterResolution = pr;
    
                //e.Graphics.DrawImage(img,new Point(0, 0));
    
                int X = 0;//printDocument1.DefaultPageSettings.Margins.Left;
                int Y = 0;// printDocument1.DefaultPageSettings.Margins.Top;
                int Genislik = pictureBox1.Width;
                int Yukseklik = pictureBox1.Height;
                e.Graphics.DrawImage(pictureBox1.Image, X, Y, Genislik, Yukseklik); 
    
    
            }
            
            private void compbutton5_Click(object sender, EventArgs e)
            {
                printPreviewDialog1.ShowDialog(this);
     
            }
    
            private void compbutton6_Click(object sender, EventArgs e)
            {
                pageSetupDialog1.ShowDialog(this);
              
            }

    שבת 14 אפריל 2012 14:41

תשובות

כל התגובות

  • To draw your image to a certain size, use a DrawImage overload that takes a destination size.
    שבת 14 אפריל 2012 15:22
  • draw image size is pixel ? right ?

    So when i use 838 and 1169 pixel for drawimage, printed picture fit for A4. But bad quality.

    When i use 2480 pixel widht and 3507 for drawimage, printed picture is so huge for A4. 25% picture be printed with A4. But best quality. Also at photoshop picture have 21cm width and 30 cm hegiht when resolution 2480 pixel width and 3507 pixel height.

    How can i use 2480 pixel widht and 3507 pixel height to printed picture fit for A4 ?

    שבת 14 אפריל 2012 15:41
  • draw image size is pixel ? right ?

    So when i use 838 and 1169 pixel for drawimage, printed picture fit for A4. But bad quality.

    When i use 2480 pixel widht and 3507 for drawimage, printed picture is so huge for A4. 25% picture be printed with A4. But best quality. Also at photoshop picture have 21cm width and 30 cm hegiht when resolution 2480 pixel width and 3507 pixel height.

    How can i use 2480 pixel widht and 3507 pixel height to printed picture fit for A4 ?


    To draw your image to a certain size, use a DrawImage overload that takes a destination size.  Printer display units are 1/100 inch.
    שבת 14 אפריל 2012 15:51
  • i dont understand. if there were a solution, can you show me as code ?
    שבת 14 אפריל 2012 16:22
  • Can you find DrawImage in the help files?  Use the overload that draws the image to a destination rectangle.  It is listed as DrawImage(image, Rectangle) and there is example code.
    שבת 14 אפריל 2012 17:03
  • There are 30 way to use drawimage. Which one should i use ? And i couldnt see any way to use resolution at drawimage.

    There are Rectangle, point, size, margins and image.

    Also there is widht and height. widht and height as pixel. I got problem at here.

    So when i use 838 and 1169 pixel for drawimage, printed picture fit for A4. But bad quality.

    When i use 2480 pixel widht and 3507 for drawimage(300 dpi), printed picture is so huge for A4. 25% picture be printed with A4. But best quality. Also at photoshop picture have 21cm width and 30 cm hegiht when resolution 2480 pixel width and 3507 pixel height.

    How can i use 2480 pixel widht and 3507 pixel height to printed picture fit for A4 ?

    • נערך על-ידי JuniorCsharp שבת 14 אפריל 2012 17:18
    שבת 14 אפריל 2012 17:09
  • Use the one I suggested in my last post.  If you couldn't find the code here it is:

    e.Graphics.DrawImage(pictureBox1.Image, e.PageBounds)

    • סומן כתשובה על-ידי JuniorCsharp שבת 14 אפריל 2012 18:57
    שבת 14 אפריל 2012 17:41