いつもお世話になっています。C#において、印刷するアプリケーションを作成しています。現在つまづいている箇所は「A4縦用紙にデバッグ時は手差しから、本番時はトレイから印刷する」という事です。以下のように記述して、実際のプリンターで印刷しても既定のトレイ(?)から印刷されてしまいます。そして、手差しが設定できていないので、A4縦の設定も出来ていないのでは?と思っています。PageSetupDialogを使って設定すれば可能ですが、A4縦と固定された印刷フォーマットを作成しますので、PageSetupDialogを使わずに行いたいと考えています。以上、よろしくお願い致します。コード抜粋 class ReportSendContent : PrintDocument { public ReportSendContent() { this.PrintPage += new PrintPageEventHandler(ReportSendContent_PrintPage); //this.PrinterSettings.DefaultPageSettings.PaperSource.RawKind = (int)PaperSourceKind.Manual; //設定できない } void ReportSendContent_PrintPage(object sender, PrintPageEventArgs e) { foreach (PaperSize pSize in this.PrinterSettings.PaperSizes) //用紙サイズをA4 { if (pSize.Kind == PaperKind.A4) { this.pSize = pSize; e.PageSettings.PaperSize = pSize; } } foreach (PaperSource item in e.PageSettings.PrinterSettings.PaperSources) //手差しにしたい { if (item.Kind == PaperSourceKind.Manual) e.PageSettings.PaperSource = item; } e.PageSettings.Landscape = false; //用紙向きを縦 /* * 描画処理等 */ } }
- Child Tree -