我有一个我希望打印的MonoMac应用程序。目前我有以下代码:
private void PrintText(text)
{
NSTextView nsTextView = new NSTextView();
nsTextView.Font = NSFont.LabelFontOfSize(12);
nsTextView.TextColor = NSColor.Black;
nsTextView.TextStorage.Append(new NSAttributedString(text));
NSPrintOperation nsPrintOperation = GetPrintOperation(nsTextView); // Creates a NSPrintOperation and NSPrintInfo as well as set my default settings
nsTextView.Bounds.Width = nsPrintOperation.PrintInfo.PaperSize.Width;
nsTextView.Bounds.Height = float.MaxValue;
nsPrintOperation.RunOperation();
}
可悲的是,当我得到一个打印对话框时,它会打印一个空白页面。我有什么想法会出错吗?