UIPrintInteractionController borderless printing
Asked Answered
M

2

5

A3

I am working on the iPhone app using print image concept using UIPrintInteractionController. I have stuck at one point i.e. border, whenever I tried to print any image using printer it always show border on all sides which is not required. Image should use whole the paper size, as I am giving the image size same as paper width and height, but still it is showing border.

I didn't find any kind of method to remove the border or make the paper content border less. See iPhone image enter image description here enter image description here

You can see in the attached image enter image description here, In this I am trying to print the image from Mac system in which it is giving option for border and border less.

I think it should be there in the UIPrintInteractionController framework, but didn't find anyone.

Please help me, if someone has experienced regarding this.

Thanks in advance. Your help will be appreciated

[![A4][4]][4]

A3

Malformation answered 24/10, 2017 at 19:16 Comment(4)
On macOS the printer provides borderless paper sizes.Trismus
@Trismus but in the iPhone application, it doesn't show the option for paper size and borderless.Malformation
Look into choosePaper: delegate methodVyatka
@Vyatka Can you provide any sample code. Requirement is just that margins shouldn't be there.Malformation
V
8

If you want to eliminate any borders you could quickly achieve that by passing a photo outputType to a printInfo object:

let printController = UIPrintInteractionController.shared
printController.printingItem = someImage
printController.showsPaperSelectionForLoadedPapers = true

let printInfo             = UIPrintInfo.printInfo()
printInfo.outputType      = .photo
printController.printInfo = printInfo

enter image description here

Now, if you want greater control over the final rendering, you could explore Apple's sample project regarding UIPrintInteractionController

Velez answered 27/10, 2017 at 9:55 Comment(5)
It's works only for A4 page size, not for others and print preview never give the option to choose paper size, how to get thatMalformation
I am accepting your answer, it is working 70% fine but not for all papers.Malformation
@MinkleGarg Can you provide a mini project demonstrating the problem? Do you use a custom UIPrintFormatter / UIPrintPageRenderer?Velez
I have added two images in the question, one is A4 and other is A3, When I load the image of A4 size then it is working fine, but suppose user has selected A3 options before print preview in custom option, then the print preview is not correct.Malformation
This worked for me for specialty 54x86mm paper. Nice!Companionate
T
2

Objective-C version

UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
printController.printingItem = someImage;
controller.showsPaperSelectionForLoadedPapers=YES;

UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputPhoto;
printController.printInfo = printInfo;
Tachometer answered 2/11, 2017 at 10:8 Comment(1)
UIPrintInfoOutputPhoto used for best quality output for imagesTachometer

© 2022 - 2024 — McMap. All rights reserved.