【问题标题】:How to read a XPS file in C# using Asp.Net?如何使用 Asp.Net 在 C# 中读取 XPS 文件?
【发布时间】:2014-06-05 10:43:14
【问题描述】:

我正在将我的 Windows 应用程序复制到 Web 应用程序。在这之间,我遇到了 XPS 文件的一些问题。在 Windows 应用程序中,我正在使用以下代码读取 XPS 文件..,

  List<string> lData = new List<string>();
        using (XpsDocument xpsDoc = new XpsDocument(FullfileName, System.IO.FileAccess.Read))
        {
            FixedDocumentSequence docSeq = xpsDoc.GetFixedDocumentSequence();
            Dictionary<string, string> docPageText = new Dictionary<string, string>();
            for (int pageNum = 0; pageNum < docSeq.DocumentPaginator.PageCount; pageNum++)
            {
                DocumentPage docPage = docSeq.DocumentPaginator.GetPage(pageNum);
                foreach (System.Windows.UIElement uie in ((FixedPage)docPage.Visual).Children)
                {
                    if (uie is System.Windows.Documents.Glyphs)
                    {
                        lData.Add(((System.Windows.Documents.Glyphs)uie).UnicodeString);
                    }
                }
            }
        }

现在,如果我在 Web 中复制相同的内容,则意味着我遇到了错误。

'The invocation of the constructor on type 'System.Windows.Documents.DocumentReference'
 that matches the specified binding constraints threw an exception.
' Line number '3' and line position '20'.

此错误发生在我的代码的以下行中

FixedDocumentSequence docseq=xpsDoc.GetFixedDoCumentSequence()

请帮我解决这个问题

【问题讨论】:

    标签: asp.net windows xps


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-14
      • 1970-01-01
      • 2020-09-21
      • 2018-03-08
      相关资源
      最近更新 更多