Blank pages when implementing DocumentPaginator

那年仲夏 提交于 2019-12-02 09:49:45

I'll answer my own tumbleweed (again):

public override DocumentPage GetPage(int pageNumber) {
  Canvas container = new Canvas();
  container.Children.Add(canvas);
  double scaleX = pageSize.Width / canvas.Width;
  double scaleY = pageSize.Height / canvas.Height;
  container.RenderTransform = new ScaleTransform(scaleX, scaleY);

  container.Width = PageSize.Width;
  container.Height = PageSize.Height;
  container.Measure(PageSize);
  container.Arrange(new Rect(new Point(0, 0), PageSize));

  Rect contentBox = new Rect(PageSize);

  return new DocumentPage(container, PageSize, contentBox, contentBox);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!