Add image in pdf using Prawn

后端 未结 1 1630
鱼传尺愫
鱼传尺愫 2021-02-13 19:03

I\'ve a problem for adding images into a PDF using Prawn as pdf generator. I\'m trying to add image using the following code:

def header
  text \"something\"
  i         


        
1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-13 19:40

    Prawn::DATADIR is new, it has been introduced recently about 2 or 3 months ago. Previously one would have used Prawn::BASEDIR/data instead. If you are using the current 0.12.0 version of the gem, you should stick with Prawn::BASEDIR/data. If you are using Rails 3.1, you can also put your image in the asset directory and use "#{Rails.root}/app/assets/images/logo_small.png"

    0 讨论(0)
提交回复
热议问题