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
Jonathan GreenJonathan Green 

analytics:reportChart when renderas pdf (or getcontentaspdf)

Using the new(ish) analytics:reportChart we can very easily display a report's chart in a visualforce page. When attempting to render as PDF in the <apex:page> tag, or getcontentaspdf(), the report charts are not included. 

The report is dynamic, filtered by the ACCOUNT_ID, so I cannot use the ol' grab the image URL from a dashboard:
<analytics:reportChart developerName="Sample_Developer_Name" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!acc.Id}'}]"/>

I am hesitant about using the old Google Image Charts integration, though it's functional, because it's deprecated and there are rumors of taking it offline. I've checked and cannot find an alternate service for image charts. The image charts build an image from URL parameters alone, and return a png, no javascript involved, which seems to be what trips up the pdf converter in APEX. 

Has anyone found a solution for getting analytics:reportchart or on-the-fly graphs/charts included in APEX?

Thanks!

Jonathan GreenJonathan Green
Our primary use case for this is in Salesforce1, to email out a PDF of the page including the report. This eliminates solutions that use desktop browser print functions or other browser add ons.
Ashutosh Rajput 5Ashutosh Rajput 5
Hi jonathan,

Have you got any solutiion,same problem i am facing, When i use renderAs="PDF" in my vf page, I am not able to show report chart in my pdf.
Could you Please tell me, How it can be solved??

Thanks