IXpsFixedDocumentWriter Arabirim

Tanım

yazma FixedDocumentyöntemlerini ve özelliklerini tanımlar.

public interface class IXpsFixedDocumentWriter : System::Windows::Xps::Packaging::IDocumentStructureProvider
public interface IXpsFixedDocumentWriter : System.Windows.Xps.Packaging.IDocumentStructureProvider
type IXpsFixedDocumentWriter = interface
    interface IDocumentStructureProvider
Public Interface IXpsFixedDocumentWriter
Implements IDocumentStructureProvider
Uygulamalar

Örnekler

Aşağıdaki örnekte, bir öğesine içerik XpsDocumenteklemek FixedPage üzere sabit belge yazıcısı almak için yönteminin nasıl kullanılacağı AddFixedDocument gösterilmektedir.

// ------------------------- 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>
void AddPackageContent (XpsDocument^ xpsDocument, bool attachPrintTicket)
{
   try
   {
      PrintTicket^ printTicket = GetPrintTicketFromPrinter();
      // PrintTicket is null, there is no need to attach one.
      if (printTicket == nullptr)
      {
         attachPrintTicket = false;
      }
      // Add a FixedDocumentSequence at the Package root
      IXpsFixedDocumentSequenceWriter^ documentSequenceWriter = xpsDocument->AddFixedDocumentSequence();

      // Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
      IXpsFixedDocumentWriter^ fixedDocumentWriter = documentSequenceWriter->AddFixedDocument();

      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()
// ------------------------- 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()
' ------------------------- 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 Sub AddPackageContent(ByVal xpsDocument As XpsDocument, ByVal attachPrintTicket As Boolean)
    Try
        Dim printTicket As PrintTicket = GetPrintTicketFromPrinter()
        ' PrintTicket is null, there is no need to attach one.
        If printTicket Is Nothing Then
            attachPrintTicket = False
        End If

        ' Add a FixedDocumentSequence at the Package root
        Dim documentSequenceWriter As IXpsFixedDocumentSequenceWriter = xpsDocument.AddFixedDocumentSequence()

        ' Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
        Dim fixedDocumentWriter As IXpsFixedDocumentWriter = 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 Then
            fixedDocumentWriter.PrintTicket = printTicket
        End If

        ' Commit the 2nd document.
        fixedDocumentWriter.Commit()

        ' If attaching PrintTickets, attach one at
        ' the package FixedDocumentSequence level.
        If attachPrintTicket Then
            documentSequenceWriter.PrintTicket = printTicket
        End If

        ' Commit the FixedDocumentSequence
        documentSequenceWriter.Commit()
    Catch xpsException As XpsPackagingException
        Throw xpsException
    End Try
End Sub

Özellikler

DocumentNumber

içindeki FixedDocumentSequencesıfır tabanlı konumunu FixedDocument alır.

PrintTicket

için FixedDocumentvarsayılan yazdırma seçeneklerini ayarlar.

Uri

URI'sini FixedDocumentalır.

Yöntemler

AddDocumentStructure()

DocumentStructure XML Kağıt Belirtimi'nin (XPS) bölümünü bir XPS paketine ekler.

(Devralındığı yer: IDocumentStructureProvider)
AddFixedPage()

öğesine FixedDocumentyeni FixedPage bir ekler.

AddThumbnail(XpsImageType)

için FixedDocumentbir XpsThumbnail görüntü ekler.

Commit()

Yazıcıyı FixedDocument temizler ve kapatır.

Şunlara uygulanır