Our Rails project relates to invitation templates. Each card is published with attached HTML/CSS stored in the database. The design would involve use of multiple fonts. They are set as below for each card and stored in the DB.
**`@font-face { font-family: 'abadi_mt_condensed_lightRg'; src: url('/assets/abadi_mt_condensed_light_regular-webfont.ttf') format('truetype'), font-weight: normal; font-style: normal; }
--------------------------------------------------**----------------------
` We want to use wkhtmltoimage/IMGkit for conversion of the card into an image. Looks like Base64 encoding works best for such conversion without distortions(Is it correct?). Storing in Base64 format in the database will something huge & tedious when it involves a large number of cards. We want to use Ruby method as below on the fly when request is made.
`Base64.encode64(file.open('/assets/abadi_mt_condensed_light_regular-webfont.ttf') { |io| io.read })`
------------------------------------------------------------------------
How to do this? Any suggestions are highly appreciated.