React exportToPDF

I am trying to figure out how to fix the error:

GanttChart.tsx:1244 Uncaught TypeError: gantt.exportToPDF is not a function
at GanttChart.xyzJ.GanttChart._exportPDF (GanttChart.tsx:1244)
at onClick (GanttChart.tsx:180)
at HTMLUnknownElement.callCallback (react-dom.development.js:149)
at Object.invokeGuardedCallbackDev (react-dom.development.js:199)
at invokeGuardedCallback (react-dom.development.js:256)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:270)
at executeDispatch (react-dom.development.js:561)
at executeDispatchesInOrder (react-dom.development.js:583)
at executeDispatchesAndRelease (react-dom.development.js:680)
at executeDispatchesAndReleaseTopLevel (react-dom.development.js:688)
at forEachAccumulated (react-dom.development.js:662)
at runEventsInBatch (react-dom.development.js:816)
at runExtractedEventsInBatch (react-dom.development.js:824)
at handleTopLevel (react-dom.development.js:4826)
at batchedUpdates$1 (react-dom.development.js:20404)
at batchedUpdates (react-dom.development.js:2151)

Hello,
To import and export the data, you need to include the export’s api.js file:
https://docs.dhtmlx.com/gantt/desktop__export.html
In React, Angular, and other frameworks, it would be easier to save it locally and import it on the page.

Here is a React demo with that approach:
https://files.dhtmlx.com/30d/9f1198f54ba3138e66a6877e35d7366e/react+export_7.0.1.zip
You need to copy the api.js from src to node_modules/dhtmlx-gantt/codebase/

Is there any other way to import api.js for React? I don’t think manually adding a file in the node_modules/ directory is a good approach for development and CI. I tried to import api.js in the index.html created by create-react-app and that gives an error:

Uncaught ReferenceError: gantt is not defined

Do you consider adding api.js in your dhtmlx-gantt npm library?

Hello,
Unfortunately, I cannot suggest a React approach for that.
But there is an easier way. You can add the contents of the file to the Gantt.js file that has the Gantt configuration.

I’ll forward your suggestion to the dev team. They will think about adding that file in the archive with Gantt.
However, the export’s api.js file is sometimes updated, and there is no way to know about it unless you manually download the file from our website.