gpt4 book ai didi

ios - AirPrint UIImage A4

转载 作者:行者123 更新时间:2023-11-28 21:53:25 25 4
gpt4 key购买 nike

我的应用程序当前正在创建大小为 2480 3508 的图像(A4 页面)如何将此图像发送到 A4 页面上的 AirPrint?创建图像后,它会将其保存到照片应用程序中,我还想将其发送以进行打印。有任何想法吗?谢谢

最佳答案

您需要使用 UIPrintInteractionController,并将图像设置为 printingItem。根据您选择的打印质量(照片模式或标准),默认纸张可能小于 a4,但用户可以在打印对话框中选择 a4。

`- (void) printImage: (UIImage *) myImage {
UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputPhoto;
printInfo.jobName = @"Testprint";
printInfo.duplex = UIPrintInfoDuplexNone;
controller.printingItem = myImage;
controller.showsPaperSelectionForLoadedPapers = YES;

void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
if (!completed && error)
NSLog(@"FAILED! due to error in domain %@ with error code %u",
error.domain, error.code);
NSLog(@"Completed: %s", (completed?"YES":"NO"));
};
[controller presentAnimated:YES completionHandler:completionHandler];
}`

关于ios - AirPrint UIImage A4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27422456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com