我正在尝试在我的 OS X 应用程序中实现打印,但有一个我无法解决的问题,我希望你们中的一个人有一个想法。
例如,在 Safari 中,您可以点击打印,打印面板将显示内容将如何以纵向模式打印,如果您单击方向按钮,它将以横向模式显示内容。


请注意,内容会随着方向的每次变化而缩放。
如果我在我的应用程序中尝试相同的内容,则内容不会改变;它的宽度在纵向和横向上保持不变。
NSPrintOperation 或 NSPrintInfo 中是否有我可能忽略的设置?
更新- 现在使用代码:
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings error:(NSError **)outError {
    NSPrintInfo *pInfo = [NSPrintInfo sharedPrintInfo];
    [pInfo setLeftMargin:32];
    [pInfo setRightMargin:32];
    [pInfo setTopMargin:64];
    [pInfo setBottomMargin:64];
    [pInfo setHorizontalPagination:NSFitPagination];
    [pInfo setVerticallyCentered:NO];
    [[pInfo dictionary] setValue:[NSNumber numberWithBool:YES] forKey:NSPrintHeaderAndFooter];
    [[pInfo dictionary] addEntriesFromDictionary:printSettings];
    PrintTextView *printView = [[[PrintTextView alloc] initWithFrame:[pInfo imageablePageBounds]] autorelease];
    printView.printJobTitle = @"Printed";
    MSTablePrint *tPrint = [[[MSTablePrint alloc] init] autorelease];
    NSMutableArray *itemArray = [[[NSMutableArray alloc] init] autorelease];
    /*
        Objects are added to "itemArray"
     */
    NSAttributedString *atString = [tPrint attributedStringFromItems:itemArray];
    [[printView textStorage] setAttributedString:atString];
    NSPrintOperation *printOp = [NSPrintOperation printOperationWithView:printView printInfo:pInfo];
    return printOp;
}
- (IBAction)print:(id)sender {
    NSError *printError = nil;
    NSPrintOperation *printOperation = [self printOperationWithSettings:nil error:&printError];
    [[printOperation printPanel] setOptions:[[printOperation printPanel] options] | NSPrintPanelShowsPageSetupAccessory];
    [printOperation runOperation];
}
非常感谢您的帮助,最良好的祝愿,uem