gpt4 book ai didi

iphone - 如何预览UIWebview打印?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:53:20 25 4
gpt4 key购买 nike

我想打印 UIWebView。用户可以选择纵向或横向模式打印。但是我不知道如何进行界面预览,因为我无法计算打印区域。请帮忙!

最佳答案

你可以这样做

-(void)printWebView{
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
pic.printInfo = printInfo;
pic.printFormatter = [webView viewPrintFormatter];
pic.showsPageRange = YES;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *printController, BOOL completed, NSError *error)
{
if (!completed && error)
{
NSLog(@"Printing could not complete because of error: %@", error);
}
};
[pic presentAnimated:YES completionHandler:completionHandler];

关于iphone - 如何预览UIWebview打印?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9428993/

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