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

Regression from 1.5.0rc1 to 1.5.3 (images in tables) #1608

Closed
rillbert opened this issue Mar 13, 2020 · 3 comments
Closed

Regression from 1.5.0rc1 to 1.5.3 (images in tables) #1608

rillbert opened this issue Mar 13, 2020 · 3 comments
Assignees
Milestone

Comments

@rillbert
Copy link

Hi.
I think that I have found a regression in how image content in tables are handled in situations where the image is deemed 'too large'.

The attached zip contains an adoc and two associated images. It is rendered in v1.5.0rc1 but will crash v1.5.3.

bug_report.zip

@mojavelinux
Copy link
Member

mojavelinux commented Mar 14, 2020

While this seems like a bug, it's actually the expected behavior. You have not reserved enough room in the column for the image to fit with its natural size. And the reason for the error has to do with limitations in how text is arranged in Prawn (otherwise, we get other problems, like #1516).

There are numerous ways to solve this problem:

  1. Increase the width of the column (e.g., cols="30s,40,30")
  2. Give the image an explicit width that is less than the computed width of the column (e.g., pdfwidth=1.5in)
  3. Add the AsciiDoc style to the table cell with the image (which changes how images are arranged)
  4. Add the AsciiDoc style to the table cell with the image and use a block image instead of an inline image

The last solution is the most robust because it allows the image to be resized to fit the column width if necessary.

a|image::3-0_Imaging_Camera_gain.PNG[]

Related issue: #1555.

@mojavelinux mojavelinux self-assigned this Mar 14, 2020
@mojavelinux mojavelinux added this to the support milestone Mar 14, 2020
@mojavelinux
Copy link
Member

Btw, this use case is documented in the Known Limitations section in the README.

Inline images in table cells must fit within available space or Prawn::Errors::CannotFit error will be thrown.

@rillbert
Copy link
Author

rillbert commented Mar 15, 2020 via email

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