2014-03-13 45 views
0

我想用我的標準辦公室打印機在相紙上打印UIImage,尺寸正好爲15x10釐米(6英寸x4英寸),在其紙盤中放有該特定紙張。如何打印未被切斷的UIImage?

無論我做什麼,圖像都會被切斷。如果它不包含文本數據和圖像(它代表明信片),那麼這將不是什麼大問題。所以打印整個UIImage是絕對必要的。

我嘗試不同的方法,目前我在做這樣的:

var printInfo = UIPrintInfo.PrintInfo; 
printInfo.OutputType = UIPrintInfoOutputType.Photo; 
printInfo.Orientation = UIPrintInfoOrientation.Landscape; 

float pageWidth = 5.90551181102362f * 72; 
float pageHeight = 3.93700787401575f * 72; 

var foo = new UIImageView(); 
foo.Frame = new RectangleF(0, 0, pageWidth, pageHeight); 
foo.ContentMode = UIViewContentMode.ScaleAspectFill; 
foo.Image = _postcard; 

_printer = UIPrintInteractionController.SharedPrintController; 
_printer.PrintInfo = printInfo; 
_printer.ShowsPageRange = false; 

_printer.PrintFormatter = foo.ViewPrintFormatter; 

await _printer.PresentFromRectInViewAsync(_printButton.Frame, View, true); 

正如你可以看到這是C#,就像我跟MonoTouch的工作,但它是因爲這將是與Objective-相同的邏輯C。

我使用的UIImageView的確切尺寸爲15x10釐米,紙盒中有15x10釐米的紙張,但輸出被切斷。順便說一句:我打印(自動)選擇的紙張及其屬性到控制檯,它說有一個432x288像素/點的可打印矩形,這是比我的目標格式有點大(是否有可能iOS假定它應該使用另一種格式?)。

這讓我瘋狂......每一個提示都非常感謝。

編輯:432x288點= 6 * 72×4 * 72 = 6 * 4"

回答

0

JFYI:我的 「解決方案」 已經購買了打印機(如HP Photosmart)和一些相紙並調整輸出到特定的打印機和特定類型的紙張,通過優化圖形使重要部件不會被切斷。