Closed niknetniko closed 4 years ago
Hi @niknetniko , thanks a lot for reporting. Generally speaking, xvfb should be an option, not the norm. Which version of PdfGenerator are you using?
@gutschilla I'm using version 0.6.0.
This is weird. Running on Linux, OTP22, Elixir 19.4, wkhtmltopdf 0.12.4 yields
PdfGenerator.generate("<html><body>yo", page_size: "A5", command_prefix: nil)
15:40:28.130 [debug] {"/home/mart/.asdf/shims/wkhtmltopdf", ["--page-size", "A5", "/tmp/Xjz3QNdv.html", "/tmp/Xjz3QNdv.pdf"]}
As we both have wkhtmltopdf
on PATH, the minor version differences in wkhtmltopdf and Elixir shouldn't matter. Neither should the OS.
Could you do me a favour and try
git clone https://github.com/gutschilla/elixir-pdf-generator.git
cd elixir-pdf-generator
iex -S mix
and in your IEX shell
PdfGenerator.generate("<html><body>yo", page_size: "A5", command_prefix: nil)
and while we're at it in your (Power)shell
mix test
This reminds me that I should set up a test running on Wondows.
Also @niknetniko , are you sure that you do not specify a :command_prefix
in your config.exs
? May I kindly ask for your mix.exs
and yourconfig/config.exs
and your environment-specific config (usually config/dev.exs
)
Looking at https://github.com/gutschilla/elixir-pdf-generator/blob/b088619b38a032a3b3b06fbfbad63010a331a81e/lib/pdf_generator.ex#L258 the prefix really only kicks in when there's a configuration set accordingly or an option. The latter is untrue.
So, what's the output of
Application.get_env(:pdf_generator, :command_prefix)
@gutschilla It was indeed configured in my config.exs
file, if I remove the prefix from the config file, it works. Thank you for taking the time to look into this, I really appreciate it!
@niknetniko Glad it works now!
For some reason, when running on Windows, it always tries to use
xvfb-run
, which obviously fails. I'm not entirely sure if this is a bug or I'm missing something.I'm using:
Erlang, Elixir and wkhtmltopdf are all on my path. When running the example, I get: