Question

I printing XPS document with images, that contains QR-codes. Image creating sample here:

 Image image = CreatePresentation(qrCode);
 image.Height = 200;
 image.Width = 200;
 image.HorizontalAlignment = HorizontalAlignment.Center;
 image.VerticalAlignment = VerticalAlignment.Center;
 image.Stretch = Stretch.None;

where

 public static Image CreatePresentation(System.Drawing.Image source)
    {
        Stream stream = new MemoryStream();
        source.Save(stream, ImageFormat.Png);
        Image image = new Image();

        BitmapImage src = new BitmapImage();
        src.BeginInit();
        src.StreamSource = stream;
        src.EndInit();

        image.Source = src;
        return image;
    }

When i have monitor dpi=96 then image size on printed page (on paper after printing) more larger than when i have montor dpi=120. How i can print images with the same size on different dpi?

Was it helpful?

Solution

When i replaced

 image.Stretch = Stretch.None;

on

 image.Stretch = Stretch.Fill;

image began print correct

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top