public DocumentPaginatorWrapper(DocumentPaginator paginator, PrintableDocumentDefinition definition)
        {
            if (!(paginator.Source is PrintableDocument))
            {
                throw new Exception("This paginator can be used only in PrintableDocument classes");
            }

            _paginator = paginator;
            _definition = definition;

            doc = Source as PrintableDocument;

            var headerSize = GetModelContentSize(doc.DataContext, doc.Header, _definition.PageSize);
            var footerSize = GetModelContentSize(doc.DataContext, doc.Footer, _definition.PageSize);

            _definition.HeaderHeight = double.IsInfinity(headerSize.Height) ? 0 : headerSize.Height;
            _definition.FooterHeight = double.IsInfinity(footerSize.Height) ? 0 : footerSize.Height;

            _paginator.PageSize = _definition.ContentSize;

            ComputePageCount();

            doc.DataSource.PageCount = _paginator.PageCount;
        }
コード例 #2
0
        public DocumentPaginatorWrapper(DocumentPaginator paginator, PrintableDocumentDefinition definition)
        {
            if (!(paginator.Source is PrintableDocument))
            {
                throw new Exception("This paginator can be used only in PrintableDocument classes");
            }

            _paginator  = paginator;
            _definition = definition;

            doc = Source as PrintableDocument;

            var headerSize = GetModelContentSize(doc.DataContext, doc.Header, _definition.PageSize);
            var footerSize = GetModelContentSize(doc.DataContext, doc.Footer, _definition.PageSize);

            _definition.HeaderHeight = double.IsInfinity(headerSize.Height) ? 0 : headerSize.Height;
            _definition.FooterHeight = double.IsInfinity(footerSize.Height) ? 0 : footerSize.Height;

            _paginator.PageSize = _definition.ContentSize;

            ComputePageCount();

            doc.DataSource.PageCount = _paginator.PageCount;
        }