2

我知道如何仅使用 nsdata 打印图像

而且我也知道仅使用 UISimpleTextPrintFormatter 打印文本

问题是我想打印一张图片和它下面的文字

我怎样才能做到这一点?

以及如何从右坐标而不是左坐标开始打印?

NSMutableString *printBody = [NSMutableString stringWithFormat:@"some text"];
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
pic.delegate = self;

UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"print";
pic.printInfo = printInfo;

UISimpleTextPrintFormatter *textFormatter = [[UISimpleTextPrintFormatter alloc] initWithText:printBody];
textFormatter.startPage = 0;
textFormatter.font=[UIFont fontWithName:@"Arail Bold" size:40];
textFormatter.contentInsets = UIEdgeInsetsMake(216.0, 288.0, 72.0, 72.0);
textFormatter.maximumContentWidth = 6 * 72.0;
textFormatter.textAlignment=UITextAlignmentRight;
textFormatter.font=[UIFont fontWithName:@"Arail Bold" size:40];
pic.printFormatter = textFormatter;
pic.showsPageRange = YES;
[pic presentAnimated:YES completionHandler:NULL];
[textFormatter release];

谢谢你

4

1 回答 1

0

我不太清楚你的意思,但这有帮助吗?

// Setup Title
    theTitle = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 100, 20)];
    [self.view addSubview:theTitle];

whereinitWithFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)告诉 theTitle 放置的位置及其大小?

于 2011-08-08T02:56:14.283 回答