使用 BlockUIContainer 进行流文档分页
有谁知道如何在 FlowDocument 中的多个页面上分解大型 BlockUIControl ?现在它被切断而不是分页。我正在使用自定义 DocumentPaginator
DocumentPaginator dp = ((IDocumentPaginatorSource)doc).DocumentPaginator;
FittedDocumentPaginator fdp = new FittedDocumentPaginator(dp, 0.85, 0.85);
p.PrintDocument(fdp, "Baker Data");
public class FittedDocumentPaginator : DocumentPaginator
{
public DocumentPaginator Base { get; private set; }
public double xScale { get; private set; }
public double yScale { get; private set; }
private readonly ScaleTransform _sTransform;
public FittedDocumentPaginator(DocumentPaginator baseDp, double xScale, double yScale)
{
if (baseDp == null)
throw new ArgumentNullException("baseDp");
Base = baseDp;
this.xScale = xScale;
this.yScale = yScale;
_sTransform = new ScaleTransform(xScale, yScale);
}
public override DocumentPage GetPage(int pageNumber)
{
var page = Base.GetPage(pageNumber);
((ContainerVisual)page.Visual).Transform = _sTransform;
return page;
}
public override bool IsPageCountValid
{
get { return Base.IsPageCountValid; }
}
public override int PageCount
{
get { return Base.PageCount; }
}
public override Size PageSize
{
get { return Base.PageSize; }
set { Base.PageSize = value; }
}
public override IDocumentPaginatorSource Source
{
get { return Base.Source; }
}
}
如有任何帮助,我们将不胜感激。
Does anyone know how to break a large BlockUIControl over several pages in a FlowDocument? Right now it is getting cut off rather than paginating it. I am using a custom DocumentPaginator
DocumentPaginator dp = ((IDocumentPaginatorSource)doc).DocumentPaginator;
FittedDocumentPaginator fdp = new FittedDocumentPaginator(dp, 0.85, 0.85);
p.PrintDocument(fdp, "Baker Data");
public class FittedDocumentPaginator : DocumentPaginator
{
public DocumentPaginator Base { get; private set; }
public double xScale { get; private set; }
public double yScale { get; private set; }
private readonly ScaleTransform _sTransform;
public FittedDocumentPaginator(DocumentPaginator baseDp, double xScale, double yScale)
{
if (baseDp == null)
throw new ArgumentNullException("baseDp");
Base = baseDp;
this.xScale = xScale;
this.yScale = yScale;
_sTransform = new ScaleTransform(xScale, yScale);
}
public override DocumentPage GetPage(int pageNumber)
{
var page = Base.GetPage(pageNumber);
((ContainerVisual)page.Visual).Transform = _sTransform;
return page;
}
public override bool IsPageCountValid
{
get { return Base.IsPageCountValid; }
}
public override int PageCount
{
get { return Base.PageCount; }
}
public override Size PageSize
{
get { return Base.PageSize; }
set { Base.PageSize = value; }
}
public override IDocumentPaginatorSource Source
{
get { return Base.Source; }
}
}
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 FlowDocumentReader 控件
Try using FlowDocumentReader control