如何以横向模式打印图像

发布于 2025-01-04 05:45:17 字数 603 浏览 1 评论 0原文

我想以横向模式打印图像。尝试将 UIPrintInfor 的方向属性设置为等于 UIPrintInfoOrientationLandscape。但输出喜欢纵向模式打印。这是我的代码:

NSData *dataToPrint = [_splitter dataForImage:_currentFileIndex];       
_printController.printingItem = data;   

if ([UIPrintInfo class]) 
{       
    UIPrintInfo *printInfo = [UIPrintInfo printInfo];       
    printInfo.outputType = UIPrintInfoOutputGeneral;                        
    //printInfo.duplex = UIPrintInfoDuplexLongEdge;
    printInfo.orientation = UIPrintInfoOrientationLandscape;
    _printController.printInfo = printInfo;     
}           

出了什么问题?

I want to print images in Landscape mode. Tried to set orientation property of UIPrintInfor equals UIPrintInfoOrientationLandscape. But the output likes print in Portrait mode. Here is my code:

NSData *dataToPrint = [_splitter dataForImage:_currentFileIndex];       
_printController.printingItem = data;   

if ([UIPrintInfo class]) 
{       
    UIPrintInfo *printInfo = [UIPrintInfo printInfo];       
    printInfo.outputType = UIPrintInfoOutputGeneral;                        
    //printInfo.duplex = UIPrintInfoDuplexLongEdge;
    printInfo.orientation = UIPrintInfoOrientationLandscape;
    _printController.printInfo = printInfo;     
}           

What's wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃颗糖壮壮胆 2025-01-11 05:45:17

有关 UIPrintInfoOrientation

当可打印内容分配给 UIKit 时,UIKit 会忽略此属性
共享的 PrintingItem 或 PrintingItems 属性
UIPrintInteractionController 对象。它决定了方向
基于内容的类型。

我假设这一行 _printController.printingItem = data; 与此异常下的情况相同。

Note from docs about UIPrintInfoOrientation

UIKit ignores this property when printable content is assigned to the
printingItem or printingItems properties of the shared
UIPrintInteractionController object. It determines the orientation
based on the type of content.

I assume this line _printController.printingItem = data; just the same and under this exception.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文