Posted 8 September 2017, 1:49 pm EST<p>I am using the following code</p><p> </p><p>** Setting PrintInfo Properties of spreadSheet.Sheets **</p><p>OwnerPrintDocument printDoc = new OwnerPrintDocument(spreadSheet);</p><p>PrintPreviewDialog dlg = new PrintPreviewDialog();</p><p>dlg.Document = printDoc;</p><p>dlg.Height = 500;</p><p>dlg.Width = 500;</p><p>dlg.ShowDialog();</p><p> </p><p>The Print Preview Dialog is showing but I have 2 problems.</p><p>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).</p><p>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. </p><p> </p><p>Any help would be greatly appreciated </p><p> </p><p> </p><p> </p>
OwnerPrintDocument Only respecting some of the PrintInfo properties
Posted by: kirkkelly on 8 September 2017, 1:49 pm EST
Replied 8 September 2017, 1:49 pm ESTWith 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.