PrintTicket.PageOrientation Propriété

Définition

Obtient ou définit une valeur qui indique comment le contenu de page est orienté pour l'impression.

public:
 property Nullable<System::Printing::PageOrientation> PageOrientation { Nullable<System::Printing::PageOrientation> get(); void set(Nullable<System::Printing::PageOrientation> value); };
public System.Printing.PageOrientation? PageOrientation { get; set; }
member this.PageOrientation : Nullable<System.Printing.PageOrientation> with get, set
Public Property PageOrientation As Nullable(Of PageOrientation)

Valeur de propriété

Nullable<PageOrientation>

Une valeur PageOrientation qui spécifie comment le contenu des pages est orienté, par exemple, Landscape ou ReversePortrait.

Exceptions

Le code appelant a tenté d'affecter à la propriété une valeur qui n'est pas répertoriée dans l'énumération PageOrientation.

Exemples

L’exemple suivant montre comment utiliser cette propriété pour configurer un travail d’impression.

// 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;
}
' Use different PrintTickets for different FixedDocuments.
Dim ptFD As New PrintTicket()

If _firstDocumentPrintTicket <= 1 Then
    ' 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 += 1

Else ' if (_firstDocumentPrintTicket > 1)
    ' 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
End If

Remarques

Une null valeur pour cette propriété signifie que ce paramètre de fonctionnalité n’est pas spécifié. En outre, lorsque la valeur est null, les versions XML du PrintTicket (voir SaveTo et GetXmlStream) ne contiennent pas de balisage pour cette fonctionnalité.

Cette propriété correspond au mot clé du PageOrientation schéma d’impression.

Vous pouvez tester les options que l’imprimante prend en charge à l’aide de la PageOrientationCapability propriété.

S’applique à