使用AirPrint打印Pdf会导致截止内容 [英] Printing Pdf using AirPrint causes cut-off content

查看:416
本文介绍了使用AirPrint打印Pdf会导致截止内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我打印尺寸为'pageSize = CGSizeMake(640,832);'的pdf。这个尺寸大于A4尺寸的页面。所以我将切断一些文字(意味着它不会打印整页)。

Here i am printing pdf with size 'pageSize = CGSizeMake(640, 832);'. this size is larget then A4 size page aspected. so i will cut-off some text(means it will not print whole page).

在使用MAC打印相同的pdf时,它会在选项的帮助下打印整页(比例适合)。所以任何人都可以帮助我摆脱这个问题..在IOS sdk中是否有任何选项可以适合比例。

while printing same pdf using MAC, it will print whole page with help of option (scale to fit). so can any one help me to come out from this problem.. is there any option in IOS sdk for scale to fit.

这是我的代码..

-(void)printItem
{

NSArray *aArrPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) ;
NSString *aStr = [[aArrPaths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"PropertyReport_%d.pdf",self.propertyId]];

  // NSString *aStr = [[NSBundle mainBundle] pathForResource:@"TRADUZIONE HELP SECTIONS REV2" ofType:@"pdf"];
NSURL *url=[[NSURL alloc] initFileURLWithPath:aStr];
NSData *data=[[NSData alloc] initWithContentsOfURL:url];
printController = [UIPrintInteractionController sharedPrintController];
if(printController && [UIPrintInteractionController canPrintData:data])
{
    printController.delegate = self;
    UIPrintInfo *printInfo = [UIPrintInfo printInfo];
    printInfo.outputType = UIPrintInfoOutputGeneral;
    //printInfo.jobName = [NSString stringWithFormat:@"New Image"];
    printInfo.duplex = UIPrintInfoDuplexLongEdge;

    printController.printInfo = printInfo;
    printController.showsPageRange = YES;

    printController.printingItem = data;




    void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error)
    {
        if (!completed && error)
        {
            //NSLog(@"FAILED! due to error in domain %@ with error code %u", error.domain, error.code);
        }
    };

  //  aWebViewPDF.hidden=FALSE;
    [printController presentAnimated:YES completionHandler:completionHandler];
}

}

谢谢!

推荐答案

听起来很奇怪:

printController.showsPageRange = NO;

这似乎启用了自动缩放,但有时会在作业结束时打印一个额外的空白页。 AirPrint基本上就是巫术。

This seems to enable auto-scale, but sometimes prints an extra blank page at the end of the job. AirPrint is basically witchcraft.

这篇关于使用AirPrint打印Pdf会导致截止内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆