当前位置: 首页>>代码示例>>C#>>正文


C# XpsDocumentWriter.WritingPrintTicketRequired事件代码示例

本文整理汇总了C#中System.Windows.Xps.XpsDocumentWriter.WritingPrintTicketRequired事件的典型用法代码示例。如果您正苦于以下问题:C# XpsDocumentWriter.WritingPrintTicketRequired事件的具体用法?C# XpsDocumentWriter.WritingPrintTicketRequired怎么用?C# XpsDocumentWriter.WritingPrintTicketRequired使用的例子?那么, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在System.Windows.Xps.XpsDocumentWriter的用法示例。


在下文中一共展示了XpsDocumentWriter.WritingPrintTicketRequired事件的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintMultipleFixedContentDocuments

// ---------------- PrintMultipleFixedContentDocuments ----------------
/// <summary>
///   Prints the content of a multiple fixed document sequence.</summary>
/// <param name="pq">
///   The print queue to print to.</param>
/// <param name="async">
///   true to print asynchronously; false to print synchronously.</param>
public void PrintMultipleFixedContentDocuments(PrintQueue pq, bool async)
{
    // Create a multiple document FixedDocumentSequence.
    FixedDocumentSequence fds =
        _wpfContent.LoadFixedDocumentSequenceFromDocument();

    // Create a document writer to print to.
    XpsDocumentWriter xdwPrint = GetPrintXpsDocumentWriter(pq);

    // Set the event handler for creating print tickets for
    // each document within the fixed document sequence.
    xdwPrint.WritingPrintTicketRequired +=
        new WritingPrintTicketRequiredEventHandler(
            MultipleFixedContentDocuments_WritingPrintTicketRequired);
    _firstDocumentPrintTicket = 0;

    // Print either asynchronously or synchronously.
    if (async)
        PrintMultipleFixedContentDocumentsAsync(xdwPrint, fds);
    else
        PrintMultipleFixedContentDocuments(xdwPrint, fds);
}// end:PrintMultipleFixedContentDocuments()
开发者ID:.NET开发者,项目名称:System.Windows.Xps,代码行数:29,代码来源:XpsDocumentWriter.WritingPrintTicketRequired

示例2: MultipleFixedContentDocuments_WritingPrintTicketRequired

// ----- MultipleFixedContentDocuments_WritingPrintTicketRequired -----
/// <summary>
///   Creates a PrintTicket event handler for
///   printing a FixedDocumentSequence.</summary>
private void MultipleFixedContentDocuments_WritingPrintTicketRequired(
                Object sender, WritingPrintTicketRequiredEventArgs e)
{
    if (e.CurrentPrintTicketLevel ==
            PrintTicketLevel.FixedDocumentSequencePrintTicket)
    {
        // Create a PrintTicket for the FixedDocumentSequence. Any
        // PrintTicket setting specified at the FixedDocumentSequence
        // level will be inherited by lower level (i.e. FixedDocument or
        // FixedPage) unless there exists lower level PrintTicket that
        // sets the setting differently, in which case the lower level
        // PrintTicket setting will override the higher level setting.
        PrintTicket ptFDS = new PrintTicket();
        ptFDS.PageOrientation = PageOrientation.Portrait;
        ptFDS.Duplexing = Duplexing.TwoSidedLongEdge;
        e.CurrentPrintTicket = ptFDS;
    }

    else if (e.CurrentPrintTicketLevel ==
        PrintTicketLevel.FixedDocumentPrintTicket)
    {
        // Use different PrintTickets for different FixedDocuments.
        PrintTicket ptFD = new PrintTicket();

        if (_firstDocumentPrintTicket <= 1)
        {   // Print the first document in black/white and in portrait
            // orientation.  Since the PrintTicket at the
            // FixedDocumentSequence level already specifies portrait
            // orientation, this FixedDocument can just inherit that
            // setting without having to set it again.
            ptFD.PageOrientation = PageOrientation.Portrait;
            ptFD.OutputColor = OutputColor.Monochrome;
            _firstDocumentPrintTicket++;
        }

        else // if (_firstDocumentPrintTicket > 1)
        {   // Print the second document in color and in landscape
            // orientation.  Since the PrintTicket at the
            // FixedDocumentSequence level already specifies portrait
            // orientation, this FixedDocument needs to set its
            // PrintTicket with landscape orientation in order to
            // override the higher level setting.
            ptFD.PageOrientation = PageOrientation.Landscape;
            ptFD.OutputColor = OutputColor.Color;
        }

        e.CurrentPrintTicket = ptFD;
    }// end:else if (CurrentPrintTicketLevel==FixedDocumentPrintTicket)

    // Even though we don't show code for specifying PrintTicket for
    // the FixedPage level, the same inheritance-override logic applies
    // to FixedPage as well.
}// end:MultipleFixedContentDocuments_WritingPrintTicketRequired()
开发者ID:.NET开发者,项目名称:System.Windows.Xps,代码行数:57,代码来源:XpsDocumentWriter.WritingPrintTicketRequired


注:本文中的System.Windows.Xps.XpsDocumentWriter.WritingPrintTicketRequired事件示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。