I have a requirement where I want to display a Qr code related to a record in a visualforce page in order to generate a PDF . I have managed to generate the pdf , howver , The Qr code is not displayed ....I have tried these 3 different ways for displaying a QR code in my visualforce page ( the QR code is generated by an image formula field). Code used

Apex code for the third Method

but here is what is displayed whatever what I do :

What I got

  • 2
    What's the data type for QR_Code__c? How is the QR Code stored?
    – sfdcfox
    Commented Sep 7, 2022 at 11:56
  • 2
    Also, P.S., a query never returns a null list. It might be empty, but not null.
    – sfdcfox
    Commented Sep 7, 2022 at 11:57
  • @sfdcfox I see , thanks for the info .... The DataType for QR_Code__c is : Formula (Text)
    – user121969
    Commented Sep 7, 2022 at 20:48
  • @sfdcfox Here is the formula I used to generate the QR code: IMAGE('chart.googleapis.com/…)
    – user121969
    Commented Sep 7, 2022 at 20:51

2 Answers 2


In order to have barcodes or QR codes show up on VFpages that are rendered as PDFs, just add a Remote Site Setting for the domain the image is being generated from in your formula field (e.g., https://chart.googleapis.com or https://www.barcodesinc.com).  This will allow the image to be included in the PDF being generated.


I had the similar issue and solved based on this: https://developer.salesforce.com/forums/?id=9060G000000XatcQAC

HTML: <apex:image value="{!qrCodeUrl}"/>

Apex ControllerExtension:

public without sharing class DF_OrderPDFController {

    public String qrCodeUrl{get;set;} 
    public DF_OrderPDFController(ApexPages.StandardController stdController) {
        dfOrder = (DF_Order__c)stdController.getRecord();     
        qrCodeUrl = [SELECT DF_QR_CodeLink__c FROM DF_Order__c WHERE Id = :dfOrder.Id LIMIT 1].DF_QR_CodeLink__c;


The DF_Order__c field contains the url, it is a text formula field: "https://chart.googleapis.com/..."

You must log in to answer this question.

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