I want to read data from json and write it in pdf. Is there a way I can do it? Also, i want to make pdf downloadable.
1 resposta
Yes... reading data from json is very easy... firstly you can parse the json to a map and then use the results accordingly. Refer this once-
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_Json.htm
Then you can write things in a vf and render it as pdf.
You can generate a PDF in Lightning Component in two ways.
- You can create a Visualforce page with render as pdf and embed it in the Lightning component.
https://medium.com/@ToAnshulVerma/salesforce-lightning-generate-pdf-from-lightning-components-with-in-memory-data-cd5dffe0fe25 http://www.vermanshul.com/2017/07/lightning-generate-pdf-from-lightning.html
- Use PDF.JS library or other javascript libraries to render pdf.