PageInfoPaperTray Property |
Gets the paper tray (bin) for this page as specified in the document.
The value is implementation (printer) specific.
Syntax
public int PaperTray { get; }
Public ReadOnly Property PaperTray As Integer
Get
public:
property int PaperTray {
int get ();
}
member PaperTray : int with get
Property Value
Type:
Int32
Examples
Shows how to print page size and orientation information for every page in a Word document.
Document doc = new Document(MyDir + "Rendering.docx");
PrinterSettings.PaperSourceCollection paperSources = new PrinterSettings().PaperSources;
doc.FirstSection.PageSetup.FirstPageTray = paperSources[0].RawKind;
doc.FirstSection.PageSetup.OtherPagesTray = paperSources[1].RawKind;
Console.WriteLine("Document \"{0}\" contains {1} pages.", doc.OriginalFileName, doc.PageCount);
float scale = 1.0f;
float dpi = 96;
for (int i = 0; i < doc.PageCount; i++)
{
PageInfo pageInfo = doc.GetPageInfo(i);
Console.WriteLine($"Page {i + 1}:");
Console.WriteLine($"\tOrientation:\t{(pageInfo.Landscape ? "Landscape" : "Portrait")}");
Console.WriteLine($"\tPaper size:\t\t{pageInfo.PaperSize} ({pageInfo.WidthInPoints:F0}x{pageInfo.HeightInPoints:F0}pt)");
Console.WriteLine($"\tSize in points:\t{pageInfo.SizeInPoints}");
Console.WriteLine($"\tSize in pixels:\t{pageInfo.GetSizeInPixels(1.0f, 96)} at {scale * 100}% scale, {dpi} dpi");
Console.WriteLine($"\tTray:\t{pageInfo.PaperTray}");
PaperSource source = pageInfo.GetSpecifiedPrinterPaperSource(paperSources, paperSources[0]);
Console.WriteLine($"\tSuitable print source:\t{source.SourceName}, kind: {source.Kind}");
}
See Also