Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with prawn-icon #42

Closed
alliedarmour opened this issue Aug 25, 2020 · 1 comment
Closed

Using with prawn-icon #42

alliedarmour opened this issue Aug 25, 2020 · 1 comment

Comments

@alliedarmour
Copy link

Hey, first thanks for the great gem!
I recently tried to use the prawn-icon gem to include Font Awesome icons in my PDF document.

The issue is the following: I need the icons for my table, so I'm using the table_icon helper:

prawn_document(page_layout: :landscape, page_size: "A6", filename: "Bestellungen_#{I18n.l(Date.today)}") do |pdf|
    # pdf.font_families.update(
    #     "Font Awesome" => { :normal => Rails.root.join("app", "assets", "fonts", "fa-solid-900.ttf") }
    # )

    @orders.each do |order|
        data = [ 
            ["Salat", "Suppe", "Dessert"],
            [pdf.table_icon('fas-birthday-cake')]
        ]
        pdf.font("Helvetica", size: 20, style: :bold) do 
            pdf.float { pdf.text(order.user.name, align: :left) }
            pdf.text(l(order.day), align: :right)
        end
        pdf.move_down 10
        pdf.table(data)
    end
end

Without changing the font for the whole document to Font Awesome with pdf.font "Font Awesome", I keep getting the following error:

Your document includes text that's not compatible with the Windows-1252 character set.
If you need full UTF-8 support, use external fonts instead of PDF's built-in fonts.

But unfortunately it neither works when I just change the cell font type like this:

  cell_1 = pdf.make_cell(pdf.table_icon('fas-birthday-cake'))
  cell_1.font = "Font Awesome"

Is there anything I can do to use the gem with prawn-rails? Or might it be a problem with prawn-table?

@westonganger
Copy link
Collaborator

This is not an issue with this gem. Please continue the discussion on prawnpdf/prawn-table#124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants