作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 UITableview 中打印所有数据,它工作正常,但如果内容太长,所有内容都显示在单页中,所以我想根据 tableview 内容在多页中打印数据。
这是我的代码
float x = tableView.Frame.X;
float y = tableView.Frame.Y;
float w = tableView.Frame.Width;
float h = tableView.ContentSize.Height;
tableView.Frame = new RectangleF (x, y, w, h);
UIGraphics.BeginImageContext(tableView.Bounds.Size);
CGContext ctx = UIGraphics.GetCurrentContext();
//ctx.FillRect(canvasRect);
tableView.Layer.RenderInContext(ctx);
UIImage newImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
NSData imgData = newImage.AsPNG();
var printInfo = UIPrintInfo.PrintInfo;
printInfo.JobName = "Test: PDF Print";
var printer = UIPrintInteractionController.SharedPrintController;
printer.PrintingItems = imgData;
printer.ShowsPageRange = true;
//printer.PrintFormatter = textFormatter;
printer.Present (true, (handler, completed, err) => {
if (!completed && err != null){
Console.WriteLine ("error");
}
} );
最佳答案
您最好的选择是提供一个 UIPrintPageRenderer 并使用它来教它如何打印您的数据。
此示例展示了如何操作:
关于c# - 如何在c# monotuch中打印多个页面的UITableview内容数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25216958/
我是一名优秀的程序员,十分优秀!