The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I am using a DataGrid of size width=830, height =90.
There are two columns of size 200,625.
And the border style is thick.
Now when I print the grid. Write following code
if (((GridControl)panelMessages.Controls[i])!= null)
{
try
{
GridPrintDocument pd = new GridPrintDocument(((GridControl)panelMessages.Controls[i]), true);
// pd.PrinterSettings = ps;
pd.Print();
}
catch(Exception ex)
{
MessageBox.Show("An error occurred attempting to print the grid - " + ex.Message);
}
}
But only first column of grid is printed.
If I reduce the left and right margin of page setting
pd.DefaultPageSettings.Margins.Left=10;
pd.DefaultPageSettings.Margins.Right=10;
both columns get printed but right most border doesn''t get printed.
This I did for testing purpose. I want margin of 100 both the sides.
ADAdministrator Syncfusion Team July 22, 2004 02:54 PM UTC
If you check the values of pd.DefaultPageSettings.Bounds, what do you see? If you substract the Margins, that would give you what I think would be the area available for the grid to use (There also may be some page gutter width sinvoled as well). If that is less the the grid.Bounds, then that would explain why the grid is not printing the whole area. It normally only prints full columns that will fit into the area allocated to it for printing. This may be off by a dot or so, as it also will try to draw a frame around the grid that is not part of the grid itself.
If you want to try to force everything to fit on the one page, then you will have to increase the area of the print page that the grid can use, or you will have to reduce the size of the grid in some way. The latter could be done by tweaking the column widths, or you could snap a bitmap of the full grid, and then draw the bitmap scaled to the allocated page size. This last option is illustrated in the Grid\Samples\In Depth\PrintToFit sample.
UMUmangiJuly 22, 2004 03:01 PM UTC
That''s OK if both columns are printed on different pages.
I want very simple solution
>If you check the values of pd.DefaultPageSettings.Bounds, what do you see? If you substract the Margins, that would give you what I think would be the area available for the grid to use (There also may be some page gutter width sinvoled as well). If that is less the the grid.Bounds, then that would explain why the grid is not printing the whole area. It normally only prints full columns that will fit into the area allocated to it for printing. This may be off by a dot or so, as it also will try to draw a frame around the grid that is not part of the grid itself.
>
>If you want to try to force everything to fit on the one page, then you will have to increase the area of the print page that the grid can use, or you will have to reduce the size of the grid in some way. The latter could be done by tweaking the column widths, or you could snap a bitmap of the full grid, and then draw the bitmap scaled to the allocated page size. This last option is illustrated in the Grid\Samples\In Depth\PrintToFit sample.
ADAdministrator Syncfusion Team July 22, 2004 03:11 PM UTC
The simplest solution I know would be to reduce the grid.Bound and the column widths until everything prints on one page with teh margins you want.
The next simplest thing would be to use the PrintToFit technique by copying the code from the sample.