Objective c 如何使用NSPrintOperation添加标头?

Objective c 如何使用NSPrintOperation添加标头?,objective-c,xcode,macos,header,nsprintoperation,Objective C,Xcode,Macos,Header,Nsprintoperation,我想为我的Mac OSX应用程序打印带有页眉和页脚页码的myWebView内容。到目前为止,我能够使用以下链接中的代码打印myWebView的内容 我已将PrintTextView类添加到我的项目中。我一直在阅读OSX库文档和NSPrintOperation方法,但到目前为止,作为一名新手,我无法理解如何添加页眉和页脚。非常感谢您的帮助、任何示例代码或指导。使用CTMacUser建议的WebUIDelegate方法 #pragma mark - WebUIDelegate Methods -

我想为我的Mac OSX应用程序打印带有页眉和页脚页码的myWebView内容。到目前为止,我能够使用以下链接中的代码打印myWebView的内容

我已将PrintTextView类添加到我的项目中。我一直在阅读OSX库文档和NSPrintOperation方法,但到目前为止,作为一名新手,我无法理解如何添加页眉和页脚。非常感谢您的帮助、任何示例代码或指导。

使用CTMacUser建议的WebUIDelegate方法

#pragma mark - WebUIDelegate Methods

- (float)webViewHeaderHeight:(WebView *)sender
{
    return 20.0;
}

- (void)webView:(WebView *)sender drawHeaderInRect:(NSRect)rect
{
    NSString *headerString = @"Title of page to be printed inside the header";
    [headerString drawInRect:rect];    
}

有人能帮我解决上述问题吗?我原以为我的新手技能很难解决这个问题,现在我可以看出,在这个论坛上,每个人都很难回答我的问题,9天后甚至没有一个答案或评论!您可以使用printOp=[[[myWebView大型机]框架视图]打印操作和printInfo:printInfo]吗?WebUIDelegate中有4种方法处理计算页眉和页脚高度以及实际绘制页眉和页脚。
#pragma mark - WebUIDelegate Methods

- (float)webViewHeaderHeight:(WebView *)sender
{
    return 20.0;
}

- (void)webView:(WebView *)sender drawHeaderInRect:(NSRect)rect
{
    NSString *headerString = @"Title of page to be printed inside the header";
    [headerString drawInRect:rect];    
}