2015年5月8日金曜日

FlowDocumentのページサイズと用紙サイズ

印刷の用紙サイズ:
PrintTicket.PageMediaSize

FlowDocumentのページサイズ:
FlowDocument.PageWidth
FlowDocument.PageHeight

設定例:
    // http://miteshsureja.blogspot.jp/2012/06/printing-flow-document-using-wpf.html
    FlowDocument fd = new FlowDocument();
    
    ...

    var prn = new PrintDialog();

    var t = prn.PrintTicket;
    t.PageMediaSize = new System.Printing.PageMediaSize(System.Printing.PageMediaSizeName.ISOA3, 1122.51968503937, 1587.40157480315);
    t.PageOrientation = System.Printing.PageOrientation.Landscape;

    switch (t.PageOrientation.Value) {
        default:
            fd.PageWidth = t.PageMediaSize.Width.Value;
            fd.PageHeight = t.PageMediaSize.Height.Value;
            break;
        case System.Printing.PageOrientation.Landscape:
        case System.Printing.PageOrientation.ReverseLandscape:
            fd.PageWidth = t.PageMediaSize.Height.Value;
            fd.PageHeight = t.PageMediaSize.Width.Value;
            break;
    }

    UtWpfPrint.Print3("図面目次", prn, fd);

0 件のコメント:

コメントを投稿