以编程方式从 ipad 将数据发送到 wifi 打印机

发布于 2024-12-25 05:19:35 字数 87 浏览 2 评论 0原文

我正在创建一个 ipad 应用程序,在其中我想以编程方式将数据发送到 wifi 打印机。是否有任何 API 或示例代码可用于实现此目的?

谢谢。

I am creating an ipad application in which i want to send data to the wifi printer programmatically. Is there any API or sample code available to acheive this?

Thanks.

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

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

发布评论

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

评论(2

江南月 2025-01-01 05:19:35

我认为普通的打印 API 可以使用 AirPrint 来完成此任务。 http://developer.apple.com/library /IOs/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/Printing/Printing.html

此外,还有一个名为 Printopia 的出色应用程序,可让您的 Mac充当 AirPrint 主机:http://www.ecamm.com/mac/printopia/

I think the normal printing APIs will accomplish this, using AirPrint. http://developer.apple.com/library/IOs/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/Printing/Printing.html

In addition, there's a great app called Printopia that allows your Mac to serve as an AirPrint host: http://www.ecamm.com/mac/printopia/

半寸时光 2025-01-01 05:19:35

UIPrintInteractionController *pic = [UIPrintInteractionController 共享打印控制器];

if (pic && [UIPrintInteractionController canPrintData: self.myPDFData] ) {

pic.delegate = self;

UIPrintInfo *printInfo = [UIPrintInfo printInfo];

printInfo.outputType = UIPrintInfoOutputGeneral;

printInfo.jobName = @"PrintPdf";

printInfo.duplex = UIPrintInfoDuplexLongEdge;

pic.printInfo = printInfo;

pic.showsPageRange = YES;

pic.printingItem = self.myPDFData;

void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =

^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {

    if (!completed && error)

        NSLog(@"FAILED! due to error in domain %@ with error code %ld",

              error.domain, (long)error.code);
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

    [pic presentFromRect:self.printButton.frame inView:self.view animated:YES completionHandler:^(UIPrintInteractionController *printInteractionController, BOOL completed, NSError *error) {
    }];

} else {
    [pic presentAnimated:YES completionHandler:completionHandler];
}

}

UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];

if (pic && [UIPrintInteractionController canPrintData: self.myPDFData] ) {

pic.delegate = self;

UIPrintInfo *printInfo = [UIPrintInfo printInfo];

printInfo.outputType = UIPrintInfoOutputGeneral;

printInfo.jobName = @"PrintPdf";

printInfo.duplex = UIPrintInfoDuplexLongEdge;

pic.printInfo = printInfo;

pic.showsPageRange = YES;

pic.printingItem = self.myPDFData;

void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =

^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {

    if (!completed && error)

        NSLog(@"FAILED! due to error in domain %@ with error code %ld",

              error.domain, (long)error.code);
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

    [pic presentFromRect:self.printButton.frame inView:self.view animated:YES completionHandler:^(UIPrintInteractionController *printInteractionController, BOOL completed, NSError *error) {
    }];

} else {
    [pic presentAnimated:YES completionHandler:completionHandler];
}

}

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