异常"FixedPage不能包含另一个FixedPage".打印到XPS Document Writer时 [英] Exception "FixedPage cannot contain another FixedPage" when printing to the XPS Document Writer

查看:149
本文介绍了异常"FixedPage不能包含另一个FixedPage".打印到XPS Document Writer时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我们目前正在开发基于WPF的打印应用程序.为了能够打印整个文档的页面范围,我们使用类似于Thomas Claudius Huber在他的博客上发布的代码的代码:

http://www.thomasclaudiushuber.com/blog/2009/11/24/wpf-printing-how-to-print-a-pagerange-with-wpfs-printdialog-意味着用户可以选择特定页面且仅打印了这些页面
/

该程序可与其他打印机(真正的打印机,例如PDFCreator)完美配合.仅使用XPS Document Writer会引发以下异常:
未处理System.Windows.Xps.XpsSerializationException
Message ="FixedPage不能包含另一个FixedPage."
源=” ReachFramework”
在System.Windows.Xps.Serialization.XpsSerializationManager.RegisterPageStart()处位于System.Windows.Xps.Serialization.FixedPageSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
br/>,位于System.Windows.Xps.Serialization.ReachSerializer.SerializeObject(Object serializedObject)
,位于System.Windows.Xps.Serialization.FixedPageSerializer.SerializeObject(Object serializedObject),位于System.Windows.Xps. System.Windows.Xps.Serialization.DocumentPageSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
处的Serialization.DocumentPageSerializer.SerializeChild(可视化子,SerializableObjectContext parentContext)
在System.Windows.Xps.Serialization.ReachS erializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.DocumentPageSerializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.DocumentPaginatorSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
在System.Windows.Xps.XpsDocumentWriter的System.Windows.Xps.Serialization.DocumentPaginatorSerializer.SerializeObject(Object serializedObject)
处. System.Windows.Xps.XpsDocumentWriter.Write(DocumentPaginator documentPaginator)的SaveAsXaml(Object serializedObject,Boolean isSync)
System.Windows.Controls.PrintDialog.PrintDocument(DocumentPaginator documentPaginator,String description)
>在ThomasClaudiusHuber.PrintRangeExample.MainWindow.PrintButtonClick(Object sender,RoutedEventArgs e)在D:\ work \ temp \ printrange \ MainWindow.xaml.cs:line 62

...

这个在不同的操作系统(经过WinXP和Win 7测试)以及VS2010(.NET 4.0)的Beta2上也会发生此问题.

谢谢您的帮助,

Marco

Hello,

we are currently developing a WPF based application with printing. To be able to print page ranges insted of a whole document we use code which is similar to the code posted by Thomas Claudius Huber on his blog :

http://www.thomasclaudiushuber.com/blog/2009/11/24/wpf-printing-how-to-print-a-pagerange-with-wpfs-printdialog-that-means-the-user-can-select-specific-pages-and-only-these-pages-are-printed /

The program works perfectly with other printers (real printers and e.g. PDFCreator). Only with the XPS Document Writer to following exception is thrown:

System.Windows.Xps.XpsSerializationException was unhandled
Message=”FixedPage cannot contain another FixedPage.”
Source=”ReachFramework”
StackTrace:
at System.Windows.Xps.Serialization.XpsSerializationManager.RegisterPageStart()
at System.Windows.Xps.Serialization.FixedPageSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
at System.Windows.Xps.Serialization.ReachSerializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.FixedPageSerializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.DocumentPageSerializer.SerializeChild(Visual child, SerializableObjectContext parentContext)
at System.Windows.Xps.Serialization.DocumentPageSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
at System.Windows.Xps.Serialization.ReachSerializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.DocumentPageSerializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.DocumentPaginatorSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
at System.Windows.Xps.Serialization.DocumentPaginatorSerializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.XpsSerializationManager.SaveAsXaml(Object serializedObject)
at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)
at System.Windows.Xps.XpsDocumentWriter.Write(DocumentPaginator documentPaginator)
at System.Windows.Controls.PrintDialog.PrintDocument(DocumentPaginator documentPaginator, String description)
at ThomasClaudiusHuber.PrintRangeExample.MainWindow.PrintButtonClick(Object sender, RoutedEventArgs e) in D:\work\temp\printrange\MainWindow.xaml.cs:line 62

...

This problem also occurs on different OS (tested with WinXP and Win 7) and also with Beta2 of VS2010(.NET 4.0).

Thank you for any help with this,

Marco

推荐答案

您好,Marco,

这会在某些特定文档或所有文档中发生吗?您是否有解决此问题的示例文档?

谢谢,
杰伊
msdnmg@microsoft.com
Hello Marco,

Can is this happening with some specific documents or all documents? Do you have a sample doc for repro this issue?

Thanks,
Jie
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com


这篇关于异常"FixedPage不能包含另一个FixedPage".打印到XPS Document Writer时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆