공기 프린터로 이미지를 인쇄하려고합니다. 모두는 페이지가 여기에 불필요한 라인페이지에서 불필요한 줄을 표시하는 공기 인쇄 이미지
을 포함
- (UIImage *) imageWithView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
여기에있는 UIImage 변환의 UIView에 대한 코드 여기
UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
if(!controller){
NSLog(@"Couldn't get shared UIPrintInteractionController!");
return;
}
controller.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputPhoto;
printInfo.orientation = UIPrintInfoOrientationLandscape;
printInfo.jobName = @"AirPrintSample";
controller.printInfo = printInfo;
UIImage *printImage = [self imageWithView:self.printView];
controller.printingItem = printImage;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if(completed && error)
{
NSLog(@"Printing failed due to error in domain %@ with error code %lu. Localized description: %@, and failure reason: %@", error.domain, (long)error.code, error.localizedDescription, error.localizedFailureReason);
}
else
{
if(completed)
{
// Did Some Other[enter image description here][1] Stuff
}
}
};
if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
[controller presentFromRect:self.view.frame inView:self.view animated:YES completionHandler:completionHandler];
}
else {
[controller presentAnimated:YES completionHandler:completionHandler];
}
인쇄에 내 코드입니다 인쇄 후를 제외하고 잘 작동 방법 등의 모습 인쇄 후 우리는 수평선이 많이 있음을 알 수 있습니다. 하지만 내 레이블에는 흰색 배경이 필요했습니다. 그리고 나는이 선을 그림에 그려 넣지 않을 것이 확실하며 인쇄 미리보기에는 선이 표시되지 않습니다. 아무도 도와 줄 수 있다면 미리 감사드립니다.
프린터 모델 - 브라더 QL-720nw
다음은 인쇄 된 페이지의 링크입니다. [link] (http://i.stack.imgur.com/WKyoW.jpg) –