0
我有一个使用AirPrint打印照片的问题。我打印4 * 6英寸的图像,但打印的图像尺寸太大!我该如何解决这个问题。
我可以通过编程指定纸张尺寸和照片吗?使用UIPrintInteractionController的照片尺寸
这里是截图的网址。
https://www.dropbox.com/s/1f6wa0waao56zqk/IMG_0532.jpg
`这里是我的代码
-(void)printPhotoWithImage:(UIImage *)image
{
NSData *myData = UIImageJPEGRepresentation(image, 1.f);
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
if (pic && [UIPrintInteractionController canPrintData:myData]) {
pic.delegate = self;
UIPrintInfo *pinfo = [UIPrintInfo printInfo];
pinfo.outputType = UIPrintInfoOutputPhoto;
pinfo.jobName = @"My Photo";
pinfo.duplex = UIPrintInfoDuplexLongEdge;
pic.printInfo = pinfo;
pic.showsPageRange = YES;
pic.printingItem = myData;
pic.printFormatter = format;
[format release];
void(^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *print, BOOL completed, NSError *error) {
[self resignFirstResponder];
if (!completed && error) {
NSLog(@"--- print error! ---");
}
};
[pic presentFromRect:CGRectMake((self.view.bounds.size.width - 64) + 27, (self.view.bounds.size.height - 16) + 55, 0, 0) inView:self.view animated:YES completionHandler:completionHandler];
}
}
- (UIPrintPaper *)printInteractionController:(UIPrintInteractionController *)printInteractionController choosePaper:(NSArray *)paperList
{
CGSize pageSize = CGSizeMake(6 * 72, 4 * 72);
return [UIPrintPaper bestPaperForPageSize:pageSize withPapersFromArray:paperList];
}
只是这是我的代码。我应该使用UIPrintPageRenderer
属性来划出区域吗?
`
显示您的代码..... – 2013-05-14 10:02:39
感谢您的快速回复,但我是新来的这个网站,所以我不能附上我的代码不幸。 我指定了纸张尺寸,我该怎么做才能限制照片尺寸? – Zhenxin 2013-05-14 10:09:35
更新问题使用你想要的图像的高度和宽度不是英寸:( – Rushabh 2013-05-14 10:15:58