2012-12-11 59 views
0

我使用下面的代碼在MonoTouch的打印圖像(png文件):打印的圖像佔用了整個頁面中的MonoTouch

的圖像打印出來,但佔據整個頁面。我如何才能將圖像限制爲其實際尺寸? (大約是200像素×200像素)

編輯:

改變了我的代碼,這一點,但還是同樣的結果:

void Print() 
     { 
      UIImage image = myImgView.Image; 


      NSData data = new NSData(); 


//   var imageRect = new RectangleF(){ 
//    Height = image.Size.Height, 
//    Width = image.Size.Width, 
//    Size = image.Size 
// 
//   } ; 


      var printInfo = UIPrintInfo.PrintInfo; 

      printInfo.JobName = "Test"; 



      var printer = UIPrintInteractionController.SharedPrintController; 

      printer.PrintInfo = printInfo; 
      printer.PrintingItem = data; 
      printer.PrintFormatter = new UIPrintFormatter(){ 
       MaximumContentWidth = image.Size.Width 
      } ; 

      printer.ShowsPageRange = true; 

      printer.Present (true, (handler, completed, err) => { 
       if (!completed && err != null) { 
        Console.WriteLine ("error"); 
       } 
      }); 
     } 

回答