Question

I want to print an UIImage on photo paper with the size of exactly 15x10 cm (6"x4") with my standard office printer, which has that specific paper in its tray.

Whatever I do, the image gets cutted-off. What would not be a huge deal if it would not contain text data and an image as well (it represents a postcard). So it is absolutely necessary to get the whole UIImage printed.

I tried different ways, currently I am doing it like this:

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

As you can see that's C# as I am working with MonoTouch, however it is the same logic as it would be with Objective-C.

I am using an UIImageView with the exact size for 15x10 cm, there is 15x10 cm paper in the tray but the output gets cutted-off.

By the way: I printed the (automatically) chosen paper and its properties to the console, it says there is a printable rectangle of 432x288 px/points, which is a bit larger than my target format (is it possible iOS assumes that it should use another format?).

That is driving me nuts ... every hint is highly appreciated.

Edit: 432x288 points = 6*72 x 4*72 = 6*4".

Was it helpful?

Solution

JFYI: My "solution" has been to buy a printer (HP PhotoSmart) and some photo paper and to adjust the output to that specific printer and that specific type of paper, by optimizing the graphic so the important parts don't get cut off.

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