2013-04-18 34 views
0

我使用包含QR碼的圖像打印XPS文檔。 圖像創建樣本這裏:用圖像打印XPS文檔。不同的圖像尺寸設置不同時dpi

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

其中

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; 
    } 

當我有監視器DPI = 96然後圖像打印頁(在印刷後紙)上尺寸大於當我有montor DPI = 120多個較大。 如何在不同的dpi上打印相同尺寸的圖像?

回答

0

,當我在

image.Stretch = Stretch.Fill; 

圖像替換

image.Stretch = Stretch.None; 

開始打印正確