Is there any standard/ acceptable way of generating barcodes in salesforce? I'm exporting some pdf reports and there I need to print a barcode. I found some third party libraries like this.
But when we apply renderAs="pdf" is it still possible to do client side script calling?
If not do I need to pre-generate the barcode for each and render it as jpg or similar? As it looks like this is kind of hot topic on success.SFDC.
What is the optimum way for this.

  • 1
    JavaScript bets are off with renderAs="pdf". The easiest route is probably to look at an AppExchange package that does this in a Visualforce Component. Here's one that claims to work in PDF output also. Apr 30, 2014 at 11:01

1 Answer 1


Google used to have nice QR code image api: https://google-developers.appspot.com/chart/image/ but it's deprecated and I don't think it ever generated barcodes.

There are some online tools that you might be able to use (I haven't tried any of these, no idea what's the catch, possibly you should contact them if you expect heavy usage and make some arrangements)...

From what I remember there's a small catch if you want image to be rendered in PDF - so whichever API you'll use I recommend playing first with normal HTML page and adding the renderAs later. The catch is that it must be "safe" to request that image, you need to convince SF you know what you're doing ;)

For regular Documents it means they should be marked as "externally available image" (and pay attention to the "oid" in the link). For calls to non SF domains - you need to add the domain to Setup > Security Controls > Remote Site Settings.

  • Thanks for the clean and clear long explanation, need to give a try on these
    – highfive
    May 1, 2014 at 17:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .