Add a barcode to invoice

Fantastic! Thanks so much for the help. I now have the barcode I need (not QR code, but great example)

Cheers

2 Likes

@IntrepidBrewing may I ask where on the invoice you’d like to insert the QR code? I imagine in the payment terms box?

What we can do is allow you to use some tokens on the image link so you don’t need to use Javascript. This will be simple to implement and it will work on the web and PDF view.

With the new token your link would look like this:

http://www.qr-code-generator.com/phpqrcode/getCode.php?cht=qr&chl=@InvoiceId@&chs=75x75&choe=UTF-8&chld=L|0

Will that work?

Hi Glenn, sorry for the slow response. Yes, if we can use tokens then that would be a much better solution. Currently we need to create the invoice, save it, then modify it to pick up the invoice ID. I think your way wouldn’t require that re-editing step. Would it be a pain to implement the token support?

I would actually rather the image be at the top / bottom of the invoice rather than bang in the middle but I can live with that. Fixed positioning the image using CSS doesn’t appear to carry over into the PDF but that is a minor inconvenience.

Cheers,
Ben

I’m pleased to say that you can now use @InvoiceId@ as a token in your notes or payment terms.

<img src="http://www.qr-code-generator.com/phpqrcode/getCode.php?cht=qr&chl=@InvoiceId@&chs=75x75&choe=UTF-8&chld=L|0"/>

If you place this at the bottom of your invoice terms, it should appear close to the bottom of the invoice:

After payment terms we have “Appended text” defined in Sales >> Invoice Customisation. We could potentially also achieve the same here, but then the barcode would then automatically appear on every invoice and estimate.

1 Like

That’s much better than the JavaScript method, cheers Glenn.

It would be better for us if we could use this in the Appended Text box as we already have some text that appears on all invoices. Unfortunately I cannot get this to work with the new Token method. Works perfectly in the default payment terms box though.

Cheers.

1 Like

We’ll have a look at including this on the appended text box too. I will let you know if we are able to do this.

EDIT:

It is possible for us to extend this to also work in the footer region (Appended Text). That should be live by end of today.

You guys are awesome. Thanks.

As a bit of an explanation, we will be using the barcode to allocate returnable stock to a given invoice, to assist us with tracking our casks of beer. That way we should know who has casks that we need to collect. It is a rather cumbersome thing to do without any form of automation and this seemed like a good solution.

2 Likes

Quick update, this is now available to use in the footer “Appended Text” box, which should push it even further down the invoice.

Yep, that works perfectly. Exactly what I needed

1 Like

I’ve added the code to the footer region and there has been a positive outcome a barcode is generated. Unfortunately the barcode takes a significant amount of space (approx .25 of A4 page). Is there a way to reduce its size similar to the example further up this feature?

Hi @gjwguk

The URL used above was only an example. If you have a look on Google, there should be more flexible QR generators out there

You could use some CSS to resize it.

The CSS doesn’t appear to apply to the PDF generation, well, it didn’t for me. Works on the screen though. Finding a suitably sized barcode generator is probably the way to go.

Ah OK, I don’t think there any PDF generators that are too clever with CSS unfortunately. As you were then!

Hmm, yes, that generator seems to be ignoring the size parameter, but there are others that seem to behave better, e.g.

http://api.qrserver.com/v1/create-qr-code/?data=@InvoiceId@&size=60x60

generates

QR code generated by that URL

Something like this should work:

<img src="http://api.qrserver.com/v1/create-qr-code/?data=@InvoiceId@" style="width:60px;"/>

The PDF generator struggles with CSS3, but adding a basic width: 60px attribute should work.

Hi
I would like to add a Code 39 or Code 128 barcode to link toinvoice number and be displayed in the footer.

Please can anyone help.

Hello @clearviewcompanies

You would firstly need a generator like the one my colleague mentioned above for QR codes. You can simply use @Glenn’s example and update the web address to fit the URL of the generator, which should do the trick.

The post above uses the Invoice ID, which isn’t the invoice number but can uniquely identify the invoice on QuickFile. I found a generator, so adding something like the following should work:

<img src="https://barcode.tec-it.com/barcode.ashx?data=@InvoiceId@&code=Code39&dpi=96">

or

<img src="https://barcode.tec-it.com/barcode.ashx?data=@InvoiceId@&code=Code128&dpi=96">

Thanks you for your help.

This works at creating a Code 128 barcode with a barcode on the invoice, buy I wanted the barcode to match the invoice number, is it possible pls.

There isn’t support for invoice number at the moment I’m afraid, although you’re welcome to start a new feature request for this and we can consider it for future development.