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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridPrintDocument Margin setup problem

Thread ID:

Created:

Updated:

Platform:

Replies:

96442 Sep 14,2010 11:34 AM UTC Oct 11,2010 01:16 PM UTC Windows Forms 3
loading
Tags: GridControl
srikar ch
Asked On September 14, 2010 11:34 AM UTC

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.





Nirmal Raja [Syncfusion]
Replied On 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


srikar ch
Replied On 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

Nirmal Raja [Syncfusion]
Replied On 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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;