jordanbyron / prawn-labels

Prawn/Labels: A simple helper to generate labels for Prawn PDFs
Other
91 stars 41 forks source link

How to change font-family in prawn-label #43

Open Heng1984617 opened 6 years ago

larzknoke commented 3 years ago
  labels = Prawn::Labels.render(@label.sheets.times, :type => "Sheet") do |pdf, s|
    pdf.font_families.update("GillSans" => {
      :normal => "#{Rails.root}/app/assets/fonts/gillsans_regular.ttf",
      :bold => "#{Rails.root}/app/assets/fonts/gillsans_bold.ttf",
      :italic => "#{Rails.root}/app/assets/fonts/gillsans_italic.ttf",
    })
    pdf.font "GillSans"
    pdf.font_size 10

    pdf.text "FOO"
  end