# Convert pdf to json using external module

**URL:** <https://discourse.nodered.org/t/convert-pdf-to-json-using-external-module/70819>\
**Category:** General\
**Created:** [18 November 2022 10:09 UTC](https://discourse.nodered.org/t/convert-pdf-to-json-using-external-module/70819 "2022-11-18T10:09:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtoko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mtoko/32/138_2.png) [@mtoko](https://discourse.nodered.org/u/mtoko)\
**Post date:** [18 November 2022 10:09 UTC](https://discourse.nodered.org/t/convert-pdf-to-json-using-external-module/70819/1 "2022-11-18T10:09:17Z")

</div>

Hi

I am trying to convert a pdf to json using the npm module pdf2json. I have followed the example here  
[https://flows.nodered.org/flow/195773d3b493d81c9bf012f64da02ea3](https://flows.nodered.org/flow/195773d3b493d81c9bf012f64da02ea3)  
and modified the settings.js.  
When I start NR I get this error

```auto
Error loading settings file: /home/dp/.node-red/settings.js
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/dp/.node-red/node_modules/pdf2json/pdfparser.js from /home/dp/.node-red/settings.js not supported.
Instead change the require of pdfparser.js in /home/dp/.node-red/settings.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/dp/.node-red/settings.js:434:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/node-red/red.js:140:20) {
  code: 'ERR_REQUIRE_ESM'
}

```

Any advice appreciated

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 January 2023 10:09 UTC](https://discourse.nodered.org/t/convert-pdf-to-json-using-external-module/70819/2 "2023-01-17T10:09:35Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
