如何使用混合页面方向打印FlowDocument而不旋转?

时间:2010-09-30 10:40:01

标签: flowdocument xps

我在FlowDocument中定义了一个报告。在该报告中,我有一些部分要以横向模式打印。 为了做到这一点,我写了一个脏的DocumentPaginator hack,为标记为landscape的部分创建一个面向横向的FlowDocument。

    public override DocumentPage GetPage(int pageNumber)
    {
    // some code

                if (section.Name.Equals("landscapePage"))
                {
                    var landscapeDocument = new FlowDocument();

                    landscapeDocument.PageWidth = document.PageHeight;
                    landscapeDocument.ColumnWidth = document.PageWidth - 50;
                    landscapeDocument.PageHeight = document.PageWidth;
                    landscapeDocument.Blocks.Add(section);
                    var landscapePaginator = ((IDocumentPaginatorSource)landscapeDocument).DocumentPaginator;
                    var landscapePage = landscapePaginator.GetPage(0);
                    return landscapePage;
                }

    // more code

如果我打印到XPS文档,这看起来就像预期的那样。横向标记页面在XPS Viewer中以横向模式显示。但是,如果我直接或从XPS Viewer打印文档,打印机不会旋转横向页面,并且会裁剪内容的右侧。

我还尝试在Word中制作混合模式文档,按预期打印,但如果我将相同的文档保存为XPS并使用XPS Viewer打印,则会裁剪横向页面。这让我想知道XPS是否支持混合页面方向。

我知道我可以从页面中提取视觉并添加90度旋转变换。我已经尝试过了,它在打印时工作正常,但如果保存为XPS或PDF,页面显然会旋转,这在显示器上查看打印时不够理想。

有没有办法在不使用旋转变换的情况下以混合方向打印FlowDocuments?

0 个答案:

没有答案