I have used wkhtml2pdf on macOS, Windows and Linux for Desktop and Web for years, but now I’m building the app for the MAS, I’m having trouble with wkhtml2pdf in the macOS sandbox.
I embed wkhtml2pdf into my macOS app, but when I run from there it via Shell it is now returning with an ErrorCode 126 Permission Denied.
So I thought I needed to make a copy of wkhtml2pdf into my ApplicationData folder. When I run this copy I get an ErrorCode 126 Operation not permitted. After copying it I use a ‘chmod +x …’ command to ensure it is executable.
Here is my Shell command:
/Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application\ Support/Helpers/local/bin/wkhtmltopdf --page-size A4 --load-error-handling ignore --enable-smart-shrinking --margin-top 10 --margin-bottom 10 --encoding UTF8 --orientation Portrait file:///Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application%20Support/BamBam%20Billing/Downloads/2021-12-16_14-46-29/ReportFile_2021-12-16_14-46-29.html /Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application\ Support/BamBam\ Billing/Downloads/2021\-12\-16_14\-46\-29/BamBam\ Billing\ Export\ 2021\-12\-16\ 14\-46\-29.PDF
And here is the result:
bash: /Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application Support/Helpers/local/bin/wkhtmltopdf: Operation not permitted
How am I supposed to run a ‘foreign’ helper application from within my sandboxed macOS application?