【发布时间】: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()
请帮我解决这个问题
【问题讨论】: