We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridPrintDocument Margin setup problem

Hi,
I am using GridPrintDocument to print my Gridview.It is working fine with default margin setup,but when i am setting the values like

this.DefaultPageSettings.Margins.Bottom =25
this.DefaultPageSettings.Margins.Left = 25
this.DefaultPageSettings.Margins.Right = 25
this.DefaultPageSettings.Margins.Top = 25

it is not printing according to the mentioned values.

can u please Guide me to solve above problem.





3 Replies

NR Nirmal Raja Syncfusion Team September 20, 2010 11:43 AM UTC

Hi Sri,

Thank you for your interest in Syncfusion products.

Please try by specifying the DefaultPageSetting for the GridPrintDocument which does not have any issue in assigning the margins.

Please refer the code below which has been modified from our sample of scale to fit sample in print package of Grid.Windows:
private void button1_Click_1(object sender, EventArgs e)
{
try
{
this.gridControl1.Model.Properties.PrintFrame = false;
Syncfusion.GridHelperClasses.GridPrintDocumentAdv pd = new Syncfusion.GridHelperClasses.GridPrintDocumentAdv(this.gridControl1);
pd.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(25, 25, 25, 25);
if (this.ShowHeaderFooter.Checked)
{
pd.HeaderHeight = 70;
pd.FooterHeight = 50;
}
else
{
pd.HeaderHeight = 0;
pd.HeaderHeight = 0;
}
pd.DefaultPageSettings.Margins.Bottom = 5;
pd.DefaultPageSettings.Margins.Left = 5;
pd.DefaultPageSettings.Margins.Right = 5;
pd.DefaultPageSettings.Margins.Top = 5;

pd.ScaleColumnsToFitPage = this.ScaleColumnsToFit.Checked;
PrintPreviewDialog previewDialog = new PrintPreviewDialog();
previewDialog.Document = pd;
previewDialog.Show();
}
catch(Exception ex)
{
MessageBox.Show("Error while print preview" + ex.ToString());
}
}


Let me know if you have any concern.

Regards,
Nirmal



SC srikar ch October 6, 2010 12:13 PM UTC

Hi Nirmal,

Thanks for your reply.I modified my program as you mentioned the changes in code,but its not working.In print preview it is showing correct but when it is printed the grid is moving towards right side of the page.
I am attaching my program.please review the code and suggest me
the solution.



Thanks,
sri.




Sample Data Grid_8faf1612.rar


NR Nirmal Raja Syncfusion Team October 11, 2010 01:16 PM UTC

Hi Sri,

I tried with the sample you provided and unable to see the issue in printing, could you please check with the printer settings that has been provided in your hardware panel? There is no relevant to the grid that conflicts between the print preview and the printer. Also try by checking in the different printers and on different machines if possible to narrow down the issue on the exact specification on the configuration.

Let me know if you have any concern.

Regards,
Nirmal


Loader.
Live Chat Icon For mobile
Up arrow icon