peter-de-boer
Generator_failed error when using elixir-pdf-generator
I am trying to use GitHub - gutschilla/elixir-pdf-generator: Create PDFs with wkhtmltopdf or puppeteer/chromium from Elixir. · GitHub in my web app.
First I have tried to use it with wkhtmltopdf, but it seems it does not handle all css correctly
So, I am now using it with Chrome-headless/Puppeteer.
I have installed it according to:
Eventually, if you are using Phoenix and you would like to have your npm packages installed localy, within the
/assets/node_modulesdirectory, simply runnpm install chrome-headless-render-pdf puppeteerwithinassets/node_modulesand passprefer_local_executable: trueoption when generating the PDF like this:PdfGenerator.generate(url, generator: :chrome, prefer_local_executable: true)
Bit if I try it with an existing url, I get:
[debug] {"/usr/local/bin/node", ["/home/peter/bw/_build/dev/lib/pdf_generator/priv/node_modules/chrome-headless-render-pdf/dist/cli/chrome-headless-render-pdf.js", "--url", "http://localhost:4000/factuur/test", "--pdf", "/tmp/MlUkqisz.pdf", "--paper-width", "8.26772", "--paper-height", "11.695"]}
{:error,
{:generator_failed,
"internal/modules/cjs/loader.js:883\n throw err;\n ^\n\nError: Cannot find module '/home/peter/bw/_build/dev/lib/pdf_generator/priv/node_modules/chrome-headless-render-pdf/dist/cli/chrome-headless-render-pdf.js'\n at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)\n at Function.Module._load (internal/modules/cjs/loader.js:725:27)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)\n at internal/main/run_main_module.js:17:47 {\n code: 'MODULE_NOT_FOUND',\n requireStack: []\n}\n"}}
Any ideas?
First Post!
maxi
Last Post!
olivermt
Popular in Questions
Other popular topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security










