使用BlockUIContainer进行Flowdocument分页

时间:2011-10-13 15:59:51

标签: wpf flowdocument

有谁知道如何在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; }
    }
}

感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

尝试使用FlowDocumentReader控件