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

PDFExport fails for Angular Grid

Hello,
We are trying to export our grid data to pdf file:

toolbarClick(args: ClickEventArgs): void {
if (args.item.id === 'Grid_pdfexport') {
this.grid.pdfExport();
} else if (args.item.id === 'Grid_excelexport') {
this.grid.excelExport();
} else if (args.item.id === this.filterKey) {
this.filter.emit(args.item.id);
}
}


pdfExport is what Syncfusion provide from the grid
/**
* Export Grid data to PDF document.
* @param {pdfExportProperties} PdfExportProperties - Defines the export properties of the Grid.
* @param {isMultipleExport} isMultipleExport - Define to enable multiple export.
* @param {pdfDoc} pdfDoc - Defined the Pdf Document if multiple export is enabled.
* @param {boolean} isBlob - If 'isBlob' set to true, then it will be returned as blob data.
* @return {Promise<any>}
*
*/
pdfExport(pdfExportProperties?: PdfExportProperties, isMultipleExport?: boolean, pdfDoc?: Object, isBlob?: boolean): Promise<Object>;


we get the following error:

core.js:7187 ERROR Error: Uncaught (in promise): TypeError: Class constructor PdfDocument cannot be invoked without 'new'
TypeError: Class constructor PdfDocument cannot be invoked without 'new'
    at new PdfDocument (ej2-pdf-export.es2015.js:17567)
    at ej2-grids.es2015.js:26709
    at ZoneDelegate.invoke (zone-evergreen.js:359)
    at Object.onInvoke (core.js:30904)
    at ZoneDelegate.invoke (zone-evergreen.js:358)
    at Zone.run (zone-evergreen.js:124)
    at zone-evergreen.js:855
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Object.onInvokeTask (core.js:30885)
    at ZoneDelegate.invokeTask (zone-evergreen.js:390)
    at Zone.runTask (zone-evergreen.js:168)
    at drainMicroTaskQueue (zone-evergreen.js:559)
    at invokeTask (zone-evergreen.js:469)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)
    at resolvePromise (zone-evergreen.js:797)
    at zone-evergreen.js:862
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Object.onInvokeTask (core.js:30885)
    at ZoneDelegate.invokeTask (zone-evergreen.js:390)
    at Zone.runTask (zone-evergreen.js:168)
    at drainMicroTaskQueue (zone-evergreen.js:559)
    at invokeTask (zone-evergreen.js:469)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)

I'm just wondering if this is a known issue. 

Thanks,

Minh

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team July 4, 2019 01:42 PM UTC

Hi Minh, 
 
Greetings from Syncfusion support. 
 
We have considered “Super constructor may only be called once exception is thrown when the PdfDocument is initialized” as a defect and logged a report for the same. We will include the fix in our patch release which is expected to be rolled out by mid of July 2019. Until then we appreciate your patience.  
 
Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon