How to change default Print Page Size in Data Grid MUI?

Viewed 49

I am using Material UI 'Data Grid' to display the Data. Also, I am using its Export functionality to print a PDF.

As, The Datagrid has more than 10 columns to the content is overflowing on A4 Print Page but on A1, its displaying fine. So I want to change the default print size to 'A1'- I tried to change in @media print props but failed.

Here's my code for DataGrid:

    <DataGrid
          rows={rows}
          columns={columns}
          components={{Toolbar: GridToolbar, LoadingOverlay: LinearProgress}} 
          sx={{
            '@media print': {
              '.MuiDataGrid-main': {
                width: 'fit-content',
                fontSize: '10px',
                height: 'fit-content',
                overflow: 'visible',
              },
              marginBottom: 100,
            },
          }}
0 Answers
Related