Skip to main content

Install PDFTk on Ubuntu 18.04 Bionic

pdftk is missing from the official repository right now. That’s an issue for many people.

I needed PDFTK to be installed on Ubuntu (18.04) due to the need to manipulate PDFs. Unfortunately, because I used Laravel Forge, they only allow Ubuntu, and apparently PDFtk is not longer working with Ubuntu 18.04. There is a workaround! Follow the below to get it working.

There’s a workaround here: How can I install pdftk in Ubuntu 18.04 Bionic?

Quick and easy workaround

 

 

UPDATED 8/2/2020

Try sudo snap install pdftk

Set up symlink so it works!

sudo ln -fs /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk

The below seems not to work any more.

In SSH on your Ubuntu 18.04 server, do the below:

wget http://archive.ubuntu.com/ubuntu/pool/universe/p/pdftk/pdftk_2.02-4build1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-6/libgcj17_6.4.0-8ubuntu1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-defaults/libgcj-common_6.4-3ubuntu1_all.deb
sudo dpkg -i pdftk_2.02-4build1_amd64.deb libgcj17_6.4.0-8ubuntu1_amd64.deb libgcj-common_6.4-3ubuntu1_all.deb

Then type ‘pdftk’, it should come up.

Hope that helps!

V-For dynamic buttons spinner in VUE2 – Isolate each button loading spinner (VueJS 2)

If you’re dynamically showing buttons using V-FOR and want each button to show it’s own individual spinner if clicked, watch the below video.

This will show you how to make Vue know dynamically that the specific button has been clicked, using Vue2, Bootstrap and Fontawesome.

Laravel DOM-PDF Error – No block-level parent found. Not good.

I received this error when using a system called FusionInvoice. This relates to DOM PDF which is a Laravel vendor to allow PDFs to be created.

Error said something along the lines of  ‘No block-level parent found. Not good.’.

To fix this error, I went to my file structure and edited /vendor/dompdf/dompdf/dompdf_config.inc.php

Look for:

def("DOMPDF_ENABLE_HTML5PARSER", false);

Replace with:

def("DOMPDF_ENABLE_HTML5PARSER", true);

This should fix the issue

Change Australian mobile numbers to +61 in PHP

Recently, I was using Laravel to build an online ordering system for a restaurant. The website required users to sign up and type in an SMS verification code to activate their account. Using Twilio, we wanting the phone number to come up as the business name instead of a phone number. When signing up though, Twilio required the phone number to be in international format (Eg. +6140122222) instead of 0401222222. So, we faced the dilemma of either using javascript to replace it, or just do it in PHP so that the user will not know any different.

It was really quite easy,

$phone = '0422222222';
$formatted = substr_replace($phone,"+61",0,2);

The phone number will be displayed like +614222222 in the $formatted variable.

Obviously this will work for other countries as well, but might be easier in Australia as we only have one type of mobile number starting with ’04’.

Hope that helps!

Custom Taxonomy Filter in WordPress Admin

I’ve just created a custom post type and custom taxonomy in WordPress.

The custom post type is “product” and the taxonomy is  “metal_types“.

It’s all working well, but I want to be able to filter results based on the taxonomy in my WordPress admin page. As you have probably realised, WordPress does not natively add that functionality in, you need to do it.

Read More