OwnerPrintDocument Only respecting some of the PrintInfo properties

Posted by: kirkkelly on 8 September 2017, 1:49 pm EST

  • Posted 8 September 2017, 1:49 pm EST

    I am using the following code


    ** Setting PrintInfo Properties of spreadSheet.Sheets[0] **

    OwnerPrintDocument printDoc = new OwnerPrintDocument(spreadSheet);

    PrintPreviewDialog dlg = new PrintPreviewDialog();

    dlg.Document = printDoc;

    dlg.Height = 500;

    dlg.Width = 500;



    The Print Preview Dialog is showing but I have 2 problems.

    1. The OwnerPrintDocument respects the PrintInfo.Header and Footer properties (the header and footers show), but other properties like PrintInfo.Orientation are not being reflected in the OwnerPrintDocument (if I set PrintInfo.Orientation to Landscape it still prints in Portrait).

    2. The output in the preview is to small.  The paper size seems to be correct but It only outputs to a small area in the upper left corner of each page.  The header and footer are centered in this printed area.  This might be related to issue #1 but I cant seem to find a solution for the problem.  


    Any help would be greatly appreciated 




  • Replied 8 September 2017, 1:49 pm EST

    With OwnerPrintDraw you are creating the PrintDocument so you have to be responsible for setting any properties that affect it. We do not have the PrintDocument from within OwnerPrintDraw, all we have is the Graphics you want to draw into.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels