小编Fel*_*lix的帖子

WPF到横向的XPS

我试图从WPF控件生成XPS文档.到目前为止,打印工作,但我找不到在横向模式下创建XPS的方法.

我创建XPS文件的代码,主要来自另一个SO页面

    public FixedDocument ReturnFixedDoc()
    {
        FixedDocument fixedDoc = new FixedDocument();
        PageContent pageContent = new PageContent();
        FixedPage fixedPage = new FixedPage();

        var ctrl = new controlToPrint();

        //Create first page of document
        fixedPage.Children.Add(ctrl);
        ((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage);
        fixedDoc.Pages.Add(pageContent);
        //Create any other required pages here

        return fixedDoc;
    }


    public void SaveCurrentDocument()
    {
        // Configure save file dialog box
        Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
        dlg.FileName = "MyReport"; // Default file name
        dlg.DefaultExt = ".xps"; // Default file extension
        dlg.Filter = "XPS Documents (.xps)|*.xps"; // Filter files …
Run Code Online (Sandbox Code Playgroud)

c# wpf landscape xps orientation

12
推荐指数
1
解决办法
8449
查看次数

标签 统计

c# ×1

landscape ×1

orientation ×1

wpf ×1

xps ×1