Modify command for phantomjs invocation

Self hosted 4.5.17

I had a previous issue running PDF creation on my AMD64 system which was resolved by downloading a static binary and setting the path in .env

I’m running the production system on Raspberry Pi 4 which is flawless to date, until that is, we tried to export invoices as PDF. I searched for a static Armhf image but there doesn’t appear to be one.

On further investigation I found the following: “phantomjs -v” throws the error relating to QPA and I see an expected error code in laravel.log.

If I invoke with ‘QT_QPA_PLATFORM=“offscreen” phantomjs -v’ however I get the expected result “2.1.1”

So I thought - easy, find the PHP doing the render and modify the command. Oops, not so simple and beyond my pay grade for sure…

I trawled the code and am “reasonably” certain the logical place to do this (assuming possible) is in the RenderPDF function in CurlUtils.php, but this is outside my skills.

Is this reasonable/possible?

Many thanks

Mike

I’m sorry, I’m not sure. That is most likely the right file.

Thanks - That’s what I figured - can anyone reading this suggest the appropriate fix to enable?

I will attempt it by trial and error but have zero competence outside of vanilla PHP coding so I’m not expecting great results…

Thanks

Mike

So my coding skills are as sad as I thought - multiple combinations and all failed - ah well.

So I googled yet again and found a different repository with various images for Pi. Again after multiple attempts I found one which seems (so far) to work. Compiled this year - “2020-02-09: Added a release with libicu57 included”

For the benefit of anyone else looking for a PhantomJS executable which will work on a Pi (incl. 4) this is the link https://github.com/piksel/phantomjs-raspberrypi/releases/download/v2.1.1-r/phantomjs-armv6-rpi-v2.1.1.tar.xz

Make a dir, extract into it and change ninja .env to point to the loader script in /bin. It must be the loader rather than the final binary because that ensures the libraries are set correctly.

Given the nature of linux this may stop working when some dependency is upgraded in Raspbian but for now I’m happy and can only say - bring on V2 WITHOUT PhantomJS!

Mike

CLOSED

Haha… 100% agreed :slight_smile: