function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Creating Charts in PDF using VisualForce

We are currently trying to develop an application on VF where we need to embed charts in PDF. Wanted to see if any one had tried it before or forsee any issues with it.
I had found the following article regarding charts and VisualForce



CM-Focus LLC




The only way to include an image in a Visualforce-generated pdf is to include an image stored inside of your org. The Google Visualization toolkit does not generate such images.

A (somewhat complex) work-around that you might try would be to create a Google Image Chart (, store the image in the Documents Tab, and then include that chart image in your pdf. I'm not 100% certain that will work, but you might try it.


All of the static google charts (URL params) will work fine in the PDF generation:


Interactive charts, , will NOT work as they require javascript or flash and this doesn't work in PDF.


Only issue with the first option is this requires sending data over the internet unsecure and some stiff collared peeps might not like this.


I cannot get a visualforce page to show a simple google chart when rendered as pdf.  (It works fine if outputted as normal visualforce html page).


To test, I simply put these on the page, then tested back and forth with the renderas="pdf" property:


<apex:image url=",14.5"></apex:image>


<img src=",14.5" />




Is there a different way I should be doing this?



jg@hhs - That won't work. Images included in PDFs must be stored within infrastructure. e.g. to include the chart image in your pdf you will need to figure out a way to store the chart image as a document in the database and then reference that document's url from within your Visualforce page. If you get that to work, please share your code.


Nah, that actually works. External images was added to PDFs several release ago.


Awesome!  I will do as it says in that link and give it another shot!


and.... that worked perfectly.  Thanks so much! 


For anyone else:


Go to Setup -> Security Controls -> Remote Site Settings





Ed GroenendaalEd Groenendaal
For those that come across this thread via searching, Google Image Charts have been deprecated since April 20, 2012, only the Javascript versions are available which won't work on a VF PDF.
I found the solution here and its working properly using new Google Visualization API :)

I found solution to save visualforce chart into image.The detail solution can be found here : . The key is using canvg library : .Once it save as Attachment, we can use the image in PDF page.

Google chart API is not working anymore. Look into below solution.
salesforce-lightning-how-to-generate-pdf-with-charts-and-images (