1

I'm working on a custom report (Visual Force) to generate specific charts(using apex:radar chart) to our client. The problem is that we have to export the information to PDF format. Using the technique of include "renderAs" property on APEX tag, the PDF is generated but the chart isn't included on the PDF and the apex tags, used to show detailed information in a table, seem to be unconfigured. Have anyone ever faced this kind of problem?

enter image description here

Thank you!

  • Do you find any solution for this? This is really funny, when i google , all the solution point to external tool either Google (that also already discontinue I believe) . The idea also not popular success.salesforce.com/ideaView?id=08730000000kxa2AAA . It makes me wonder, why such critical feature not available.Most of user not happy when the chart not able being documented into PDF ...PPT so they cannot share it via email / present it etc.It hard to convince that this is not doable in Salesforce. – unidha Dec 6 '16 at 9:38
  • Just want to update, I able to generate PDF after i save chart as Attachment using canvg. Refer to here shelovestocode.com/2017/04/… – unidha Jul 5 '17 at 8:25
1

See How Visualforce Charting Works for a description. Basically, the chart is rendered client-side in JavaScript, which isn't supported by PDF. As such, you can't just render those charts in a Visualforce PDF, because they are drawn by a script that won't run when used in PDF mode. You'll need to find an alternative method of rendering those charts. Google used to have a Chart API, but that has since been discontinued (the new version also uses JavaScript).

  • Also see other limitations and the nearby documentation. – Keith C Oct 20 '15 at 19:49
  • On the Google Image Charts Google's statement is "While the dynamic and interactive Google Charts are actively maintained, we officially deprecated the static Google Image Charts way back in 2012. This gives us the right to turn it off without notice, although we have no plans to do so.". There are (probably) a large number of people betting on this service staying available indefinitely. – Keith C Oct 20 '15 at 20:09
  • @KeithC I missed that part completely. I read the news as "let's go to something that isn't going to be shut down sometime soon." Then again, this is Google, so it wouldn't surprise me if they just kept it going. – sfdcfox Oct 20 '15 at 20:57
  • Thank you guys... Any suggestion to solve that problem? I posted that problem in another forum and someone suggested me to use wkhtmltopdf.org deployed on Heroku. Basically I have to sendo my sessionID and the URL of my page to be generated... It probably works but I'm lookin for something easier. Thank you again! – Josue Nogueira Oct 20 '15 at 21:48
0

Just to show how I´ve fixed it:

We used ChartJS to generate our chart and saved the chart as an attachment (blob). That attachment was refered on the Visual Force that contained the "renderAs" attribute.

0

I found the solution here and its working properly using new Google Visualization API :)

https://developers.google.com/chart/interactive/docs/printing#overview

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.