jessedoyle / prawn-icon

Easy icons for Prawn.
Other
28 stars 15 forks source link

Prawn::Errors::CannotFit: Prawn::Errors::CannotFit when using font_size #40

Closed lethunder closed 4 years ago

lethunder commented 4 years ago

Hello, when i use

font_size 9 table_data = [["", "test1],["", table_icon("far-building")]] table(table_data, :cell_style => {:border_width => 0, :horizontal_padding => 0, :inline_format => true})

it generates Prawn::Errors::CannotFit: Prawn::Errors::CannotFit error and when i remove font_size 9, it works

Any idea?

jessedoyle commented 4 years ago

Hi @lethunder - can you confirm what version of prawn-table you're currently using?

We've encountered similar issues before, but it almost always boils down to a bug in prawn-table.

See https://github.com/jessedoyle/prawn-icon/issues/21 for reference.

Years ago I was able to submit a bugfix to prawn-table (https://github.com/prawnpdf/prawn-table/pull/60), but it looks like a version of the gem with the fix hasn't been released to rubygems.

lethunder commented 4 years ago

thanks for your quick response

prawn-icon (2.4.0) prawn-table (0.2.2)

Le lun. 9 sept. 2019 à 16:00, Jesse Doyle notifications@github.com a écrit :

Hi @lethunder https://github.com/lethunder - can you confirm what version of prawn-table you're currently using?

We've encountered similar issues before, but it almost always boils down to a bug in prawn-table.

See #21 https://github.com/jessedoyle/prawn-icon/issues/21 for reference.

Years ago I was able to submit a bugfix to prawn-table ( prawnpdf/prawn-table#60 https://github.com/prawnpdf/prawn-table/pull/60), but it looks like a version of the gem with the fix hasn't been released to rubygems.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jessedoyle/prawn-icon/issues/40?email_source=notifications&email_token=ABPOAVCM3QP4IGQBL7PJB43QIZJJFA5CNFSM4IUZDKXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HVYVQ#issuecomment-529488982, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPOAVFG7QGQJTAMQ7KNKT3QIZJJFANCNFSM4IUZDKXA .

-- Cordialement, Didier Banlock

jessedoyle commented 4 years ago

@lethunder - The bugfix I submitted to prawn-table was merged into master but it looks like a new gem version was never released to RubyGems.

I'd suggest opening an issue in prawn-table to see if the current maintainers are able to cut and release a new version.

With that being said I was able to test the code snippet above and it didn't raise any exceptions for me:

require "prawn/table"
require "prawn/icon"

Prawn::Document.generate('test.pdf') do
  font_size(9)
  table_data = [
    ["", "test1"],
    ["", table_icon("far-building")]
  ]
  table(
    table_data, 
    cell_style: {
      border_width: 0,
      horizontal_padding: 0,
      inline_format: true
    }
  )
end

You're likely getting the error because of a custom font that's being used when generating your document. That's the bug that was fixed when https://github.com/prawnpdf/prawn-table/pull/60 was merged.

For now you can try pointing your gemfile directly to the GitHub master branch of prawn-table:

gem 'prawn-table', github: 'prawnpdf/table'

But the real solution to this issue to for a new version of prawn-table to be cut and released on RubyGems.

lethunder commented 4 years ago

thanks

Le lun. 9 sept. 2019 à 16:24, Jesse Doyle notifications@github.com a écrit :

@lethunder https://github.com/lethunder - The bugfix https://github.com/prawnpdf/prawn-table/blob/03eacd01e84518f906f7fe453df0fbc879bac228/CHANGELOG.md#master I submitted to prawn-table was merged into master but it looks like a new gem version was never released to RubyGems.

I'd suggest opening an issue in prawn-table https://github.com/prawnpdf/prawn-table to see if the current maintainers are able to cut and release a new version.

With that being said I was able to test the code snippet above and it didn't raise any exceptions for me:

require "prawn/table"require "prawn/icon" Prawn::Document.generate('test.pdf') do font_size(9) table_data = [ ["", "test1"], ["", table_icon("far-building")] ] table( table_data, cell_style: { border_width: 0, horizontal_padding: 0, inline_format: true } )end

You're likely getting the error because of a custom font that's being used when generating your document. That's the bug https://github.com/jessedoyle/prawn-icon/issues/21#issuecomment-155249341 that was fixed when prawnpdf/prawn-table#60 https://github.com/prawnpdf/prawn-table/pull/60 was merged.

For now you can try pointing your gemfile directly to the GitHub master branch of prawn-table:

gem 'prawn-table', github: 'prawnpdf/table'

But the real solution to this issue to for a new version of prawn-table to be cut and released on RubyGems.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jessedoyle/prawn-icon/issues/40?email_source=notifications&email_token=ABPOAVAK2UVHAFF4L7D6NZDQIZMDTA5CNFSM4IUZDKXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HYQ4Y#issuecomment-529500275, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPOAVBV3ZICWV7TR5N4WUDQIZMDTANCNFSM4IUZDKXA .

-- Cordialement, Didier Banlock

jessedoyle commented 4 years ago

Thanks @lethunder - I'm going to close this issue as the problem lies in prawn-table.