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

PDF export not working for specific date format

Hi Team,

Unable to export grid in PDF format when use the following date format for date fields

Code:

var data = new ej.data.DataManager(window.orderData).executeLocal(
  new ej.data.Query().take(15)
);
var grid = new ej.grids.Grid({
  dataSource: data,
  allowExcelExport: true,
  allowPdfExport: true,
  toolbar: ['ExcelExport''PdfExport''CsvExport'],
  columns: [
    {
      field: 'OrderID',
      headerText: 'Order ID',
      width: 120,
      textAlign: 'Right',
    },
    { field: 'CustomerName'headerText: 'Customer Name'width: 150 },
    {
      field: 'OrderDate',
      headerText: 'Order Date',
      width: 130,
      format: 'dd-MMM-yy HH:mm',
      textAlign: 'Right',
    },
    { field: 'Freight'width: 120format: 'C2'textAlign: 'Right' },
    {
      field: 'ShippedDate',
      headerText: 'Shipped Date',
      width: 140,
      format: 'dd-MMM-yy HH:mm',
      textAlign: 'Right',
    },
    { field: 'ShipCountry'headerText: 'Ship Country'width: 150 },
  ],
});
grid.appendTo('#Grid');

grid.toolbarClick = function (args) {
  if (args.item.id === 'Grid_pdfexport') {
    grid.pdfExport();
  }
  if (args.item.id === 'Grid_excelexport') {
    grid.excelExport();
  }
  if (args.item.id === 'Grid_csvexport') {
    grid.csvExport();
  }
};


Stackblitz :  https://stackblitz.com/edit/bjqfvf?file=index.js


3 Replies 1 reply marked as answer

VB Vinitha Balasubramanian Syncfusion Team December 29, 2022 04:24 PM UTC

Mouli,


Thank you for reaching out to Syncfusion support.


We have validated your query at our end. We suggest you give the Custom date Format like below to resolve the reported problem.

 [index.js]

{

     field: 'OrderDate',

      headerText: 'Order Date',

      width: 130,

      format: { type: 'date', format: 'dd/MM/yyyy' },

      textAlign: 'Right',

    },


Refer to the below documentation for more information.

Date formatting in Grid Column: https://ej2.syncfusion.com/javascript/documentation/grid/columns/columns/#date-formatting


Sample : https://stackblitz.com/edit/bjqfvf-kwyxbw?file=index.js,index.html


Regards,

Vinitha Balasubramanian


Marked as answer

WI will January 9, 2023 09:25 AM UTC

Certain conditions on your computer, such as security settings or browser cookies, can prevent the Acrobat Reader Installer from downloading. Often, the easiest way to resolve an unsuccessful download is to try the download again using a different browser.


Regards,

Will



VB Vinitha Balasubramanian Syncfusion Team January 10, 2023 02:05 PM UTC

Will,


We understand from your update that when performing a PDF export, the Grid component converts the table to the relevant file format. If you encounter any browser-side issues, you can use any tool of your choice. However, we want to inform you that this is not a concern related to the Grid component itself, but rather an external matter.


Loader.
Up arrow icon