NSTextview
에서 PDF를 저장하고 헤더에 로고를 넣고 있습니다. 나는 pageHeader
을 지나치며 로고가 나타나지만 잘립니다.NSTextView의 헤더 높이를 변경할 수 있습니까?
NSTextView
의 헤더 높이를 변경할 수 있습니까?
감사합니다.
부분 코드 :
는-(IBAction)impLaudo:(id)sender
{
NSPrintInfo *printInfo;
NSPrintInfo *sharedInfo;
NSPrintOperation *printOp;
NSMutableDictionary *printInfoDict;
NSMutableDictionary *sharedDict;
sharedInfo = [NSPrintInfo sharedPrintInfo];
sharedDict = [sharedInfo dictionary];
printInfoDict = [NSMutableDictionary dictionaryWithDictionary:sharedDict];
[printInfoDict setObject:NSPrintSaveJob forKey:NSPrintJobDisposition];
[printInfoDict setObject:[[dirLaudos stringByAppendingString:[estudo stringValue]] stringByAppendingString:@".pdf"] forKey:NSPrintSavePath];
printInfo = [[NSPrintInfo alloc] initWithDictionary: printInfoDict];
[printInfo setHorizontalPagination: NSClipPagination];
[printInfo setVerticalPagination: NSAutoPagination];
[printInfo setVerticallyCentered:NO];
[[printInfo dictionary] setValue:[NSNumber numberWithBool:YES] forKey:NSPrintHeaderAndFooter];
printOp = [NSPrintOperation printOperationWithView:textView printInfo:printInfo];
[printOp setShowsPrintPanel:NO];
[printOp runOperation];
}
@implementation MyTextView
- (NSAttributedString *)pageHeader
{
// Adicionando cabeçalho
NSAttributedString *theHeader = nil;
NSImage * pic = [[NSImage alloc] initWithContentsOfFile:[dirLayout stringByAppendingString:@"cabecalho.jpg"]];
NSTextAttachmentCell *attachmentCell = [[NSTextAttachmentCell alloc] initImageCell:pic];
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
[attachment setAttachmentCell: attachmentCell ];
theHeader = [NSAttributedString attributedStringWithAttachment: attachment];
return theHeader;
}
@end
PDF를 생성하는 데 사용하는 코드를 게시하십시오. –