本文整理汇总了C#中System.Windows.Xps.Packaging.IXpsFixedDocumentWriter接口的典型用法代码示例。如果您正苦于以下问题:C# IXpsFixedDocumentWriter接口的具体用法?C# IXpsFixedDocumentWriter怎么用?C# IXpsFixedDocumentWriter使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
IXpsFixedDocumentWriter接口属于System.Windows.Xps.Packaging命名空间,在下文中一共展示了IXpsFixedDocumentWriter接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddPackageContent
// ------------------------- AddPackageContent ----------------------------
/// <summary>
/// Adds a predefined set of content to a given XPS document.</summary>
/// <param name="xpsDocument">
/// The package to add the document content to.</param>
/// <param name="attachPrintTicket">
/// true to include a PrintTicket with the
/// document; otherwise, false.</param>
private void AddPackageContent(
XpsDocument xpsDocument, bool attachPrintTicket)
{
try
{
PrintTicket printTicket = GetPrintTicketFromPrinter();
// PrintTicket is null, there is no need to attach one.
if (printTicket == null)
attachPrintTicket = false;
// Add a FixedDocumentSequence at the Package root
IXpsFixedDocumentSequenceWriter documentSequenceWriter =
xpsDocument.AddFixedDocumentSequence();
// Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
IXpsFixedDocumentWriter fixedDocumentWriter =
documentSequenceWriter.AddFixedDocument();
// Add content to the 1st document
AddDocumentContent(fixedDocumentWriter);
// Commit the 1st Document
fixedDocumentWriter.Commit();
// Add a 2nd FixedDocument to the FixedDocumentSequence. - - - - - -
fixedDocumentWriter = documentSequenceWriter.AddFixedDocument();
// Add content to the 2nd document.
AddDocumentContent(fixedDocumentWriter);
// If attaching PrintTickets, attach one at the FixedDocument level.
if (attachPrintTicket)
fixedDocumentWriter.PrintTicket = printTicket;
// Commit the 2nd document.
fixedDocumentWriter.Commit();
// If attaching PrintTickets, attach one at
// the package FixedDocumentSequence level.
if (attachPrintTicket)
documentSequenceWriter.PrintTicket = printTicket;
// Commit the FixedDocumentSequence
documentSequenceWriter.Commit();
}
catch (XpsPackagingException xpsException)
{
throw xpsException;
}
}// end:AddPackageContent()
开发者ID:.NET开发者,项目名称:System.Windows.Xps.Packaging,代码行数:58,代码来源:IXpsFixedDocumentWriter
注:本文中的System.Windows.Xps.Packaging.IXpsFixedDocumentWriter接口示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论