I have a set template in which there is address informations and other set of user information.
I have created a html file in the public folder and load the file at runtime and use
template = File.read("public/filename.html")
template % {key:value}
to replace the tokens with actual value and process as required.
Can anyone please let me know if its the correct way to do this, or are there any better ways like placing the template in other folders like views, bin etc?
I would use wicked_pdf. After you've installed it, create a new route and controller that will take your user/address info as params and pass them as an instance variable into your template. From there, you can can template the pdf just like a regular view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With