I’ve never looked for this package, but you may have to add it manually. Nerves supports this and there is a great talk from last year’s ElixirConf about it. I’ll try to find it if you would like.
We had a sort of shell a while back. You can add the dep from here but it isn’t your normal shell. It is usually easier to do cmd("echo hello world") but sometimes you need a bit more control in which case i do usually: _ = Nerves.Runtime.cmd("echo", ["hello", "world"], :return). The only issue with those two approaches is when you need something that does fancy stuff to the terminal such as top. (which is disabled in the default systems iirc). What are you trying to do in a regular shell? maybe i can recommend an approach.
I just had a look at the wkhtmltopdf repo
It looks like it require QT + webkit for some reason. While you can enable both of those thing in buildroot, it seems a little strange to me…
This is one of those things that is surprisingly hard and a reason to seriously thank package maintainers. There are several issues: Qt and Webkit have a lot of dependencies, Qt switched to Chromium for their web engine a while back so there’s more effort to get their Webkit integration, and the main one is that wkhtmltopdf hasn’t already been ported to Buildroot. If the last one weren’t the case, then this would be soooo much easier.
Here’s what I’d try:
See if someone has built a static linked binary of wkhtmltopdf for ARM. If yes, then try including that in a priv directory or a rootfs_overlay. If you can run it and it doesn’t crash immediately, you’re probably good.
See if you can upload the data to a server for pdf conversion.
Port wkhtmltopdf to plain-vanilla Buildroot (no Nerves). Try setting the “all static libraries” option and see if you can generate a static wkhtmltopdf binary. I.e. make option #1.
If there are issues making a static version of wkhtmltopdf, then try making one that uses dynamic libraries in plain-vanilla Buildroot. I’m certain this will work. Once you do this, the path to integrating it with Nerves will make a lot more sense.
I’m not going to lie, there’s some work here if #1 or #2 don’t pan out. I recently had to deal with this and ended up using a Qt PDF report generator (NCReport). That solution has some different challenges, but is much faster than wkhtmltopdf if you are running on a slow processor.
Hello Frank @fhunleth, I am starting to build a nerves project where I want to generate PDFs and then print them. Building my own buildroot with CUPS enabled.
I have no idea how to include NCReport. It is not in buildroot. Do you have any further information you can point me to?
Thank you very much
I’m not sure how well this will work on nerves, but I found https://weasyprint.org/ to be a good way of converting html to pdfs compared to wkhtmltopdf. Not sure how many native dependencies it has, but python should be easier than QT or webkit.
@cokron It has been a LONG time since I’ve used NCReport.
You’ll have to fork whatever Nerves system that you’re using and create a package/ncreport directory where you’ll put the Buildroot recipe files for building NCReport. You’ll also need to add a Config.in with the contents source "$NERVES_DEFCONFIG_DIR/package/ncreport/Config.in"
The Buildroot docs describe what to put in the Config.in and ncreport.mk files that you’ll need in the package/ncreport directory.
Here’s what I had from an old project that used NCReport. The project is OLD, so please, please refer to the Buildroot docs to double check it. I don’t remember why I didn’t use Buildroot’s QMake infrastructure, but maybe it didn’t exist back then. If I were to do this today, I’d use it .
Config.in
config BR2_PACKAGE_NCREPORT
depends on BR2_PACKAGE_QT
select BR2_PACKAGE_QT_SCRIPT
select BR2_PACKAGE_QT_XML
bool "ncreport"
help
NCReport is a lightweight, fast, multi-platform and easy
to use report generator tool written in C++ based on the
Qt Application framework
I can’t help with CUPS. I don’t often have to interface with printers and when I do, it seems like there’s some easier non-generic interface that I can use.