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)
{
开发者_Python百科 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.
Try using FlowDocumentReader control
精彩评论