-
Notifications
You must be signed in to change notification settings - Fork 500
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
Image in table causes Prawn error #830
Comments
face-palm. Table cells in Asciidoctor PDF are my nemesis. Technically, the converter has no access to source line numbers by default, so it's not possible to report the line. However, that does get me thinking...if the sourcemap is enabled, should the error messages include the line information that gets added to the nearest block? I think we can at least take that step. Let's pursue that in a separate issue. |
I think this is related to #447. We were waiting on an upstream release, but that seems to have happened. I wonder if it got fixed or we are looking at something new. |
I got this on Ubuntu 17.04 64 bits, asciidoc 8.6.9-5, asciidoctor 1.5.4, asciidoctor-pdf 1.5.0.alpha.16. Is there a newer release? |
The problem here is the use of an image without an explicit width in a non-AsciiDoc table cell. If you write the table as follows, it will render properly:
|
You can observe the same problem with this simple table:
If you give the image a (PDF) width that's less than the amount prawn-table allocates for the column, it will fit:
Basically, prawn-table doesn't consider the width of the image when allocating the column widths. So you need to set the column width, then set the width of the image accordingly. |
Using an AsciiDoc table cell also seems to solve the problem without having to assign a width to the image. |
The following seems to work best:
(Note this doesn't work well with an autowidth table. In that case, set an absolute width value). |
The best I can really do is document this scenario. The fact is that prawn-table will not try to increase the column width to accommodate the image (because it assumes the image is text that will wrap). So you have to adjust the widths (either the image, column, or both) until it fits. |
i think should show where the error happens at least i try to generate an existing adoc by source and get this error but don't where it happen, seem like I need to check all places of the image to find the table |
I have a document that uses an image stretched over multiple rows to describe UI options in one of our interfaces. In the HTML export this works fine. When I try to export this via asciidoctor-pdf I get the error:
--trace yields a stack like this:
The problem is the inline image in the table cell. Prawn then can't fit the table into the PDF.
The table is defined like this:
Image is attached.
I would expect to get at least a mention where this error occurs. I had to manually exclude all resources from my large export until I had found the offending page.
The text was updated successfully, but these errors were encountered: