Image in table cell crashes asciidoctor-pdf (?)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Image in table cell crashes asciidoctor-pdf (?)

wolandscat
Just having another look at asciidoctor-pdf, and seeing what has changed in the last year. One document appears to crash it, with this trace:

/usr/local/gems/prawn-2.0.1/lib/prawn/images.rb:144:in `verify_and_open_image': /tmp/image-20160916-43100-137vc04.png not found (ArgumentError)
        from /usr/local/gems/prawn-2.0.1/lib/prawn/images.rb:79:in `build_image_object'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:72:in `block in arrange_images'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:51:in `each'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:51:in `arrange_images'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:14:in `wrap'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:223:in `block (4 levels) in render'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/font.rb:102:in `font_size'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/prawn_ext/extensions.rb:254:in `font_size'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:216:in `block (3 levels) in render'
        from /usr/local/gems/pdf-core-0.5.1/lib/pdf/core/text.rb:182:in `text_rendering_mode'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:211:in `block (2 levels) in render'
        from /usr/local/gems/pdf-core-0.5.1/lib/pdf/core/text.rb:204:in `character_spacing'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:210:in `block in render'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/font.rb:208:in `save_font'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:209:in `render'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:60:in `block in natural_content_height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:99:in `block in with_font'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/font.rb:208:in `save_font'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:92:in `with_font'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:58:in `natural_content_height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:336:in `content_height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:309:in `height_ignoring_span'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:317:in `height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:373:in `block in row_heights'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:369:in `each'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:369:in `row_heights'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:656:in `set_row_heights'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:148:in `initialize'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:111:in `new'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:111:in `table'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:1290:in `convert_table'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:71:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `block in content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `map'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/block.rb:110:in `content'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:112:in `convert_content_for_block'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:497:in `convert_open'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:71:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `block in content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `map'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `content'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:112:in `convert_content_for_block'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:323:in `convert_section'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:71:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `block in content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `map'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/document.rb:1104:in `content'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:112:in `convert_content_for_block'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:163:in `convert_document'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/document.rb:1044:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor.rb:1503:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/cli/invoker.rb:94:in `block in invoke!'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/cli/invoker.rb:86:in `each'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/cli/invoker.rb:86:in `invoke!'
        from /usr/local/gems/asciidoctor-1.5.4/bin/asciidoctor:14:in `<top (required)>'
        from /home/Thomas/bin/asciidoctor:23:in `load'
        from /home/Thomas/bin/asciidoctor:23:in `<main>'

I think the offending source causing this is probably the image inside a table cell in this file. (The proper appearance of it, in HTML, is at the top of this page. I suspect the CC-BY-ND image, but may be wrong). This image is from a URI, and I have -a allow-uri-read in the asciidoctor-pdf command line.

In any case, something basic is going wrong with processing this image, or else maybe another image, I cannot tell for sure.

This may be a known error, so just checking before I report it formally.

- thomas
Reply | Threaded
Open this post in threaded view
|

Re: Image in table cell crashes asciidoctor-pdf (?)

mojavelinux
Administrator
Thomas,

I'm really not sure what's going on here. Somehow, the temporary image is disappearing before it is used. When I run the script to generate the PDF, I don't see this error. The image appears in the PDF.

I'm concerned about the gem reference to /usr/local. In my experience, using system gems for a project introduces problems. What I recommend is adding a Gemfile to the project:

```

gem 'asciidoctor-pdf'
gem 'pygments.rb'
```

Next, install the gems into the project using:

```
bundle --path=.bundle/gems
```

(If necessary, install Bundler at the system level using `gem install bundler`).

Then, prefix all asciidoctor commands in the script with `bundle exec`. That ensures that Ruby uses the gems from the project and not from the system.

This also makes it easier to debug and to keep the gems up to date without wrecking the system. When you want to start over, you just nuke .bundle/gems and the Gemfile.lock and run the bundle command again.

It also allows you to use an unreleased gem easily. You just add the following line to your Gemfile:

```
gem 'asciidoctor-pdf', github: 'asciidoctor/asciidoctor-pdf'
```

Remove the Gemfile.lock and run bundle again to switch to it.

(I've since learned it isn't necessary to use RVM if you take the approach I recommend here).

Cheers,

-Dan

On Fri, Sep 16, 2016 at 8:19 AM, wolandscat [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Just having another look at asciidoctor-pdf, and seeing what has changed in the last year. One document appears to crash it, with this trace:

/usr/local/gems/prawn-2.0.1/lib/prawn/images.rb:144:in `verify_and_open_image': /tmp/image-20160916-43100-137vc04.png not found (ArgumentError)
        from /usr/local/gems/prawn-2.0.1/lib/prawn/images.rb:79:in `build_image_object'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:72:in `block in arrange_images'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:51:in `each'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:51:in `arrange_images'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb:14:in `wrap'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:223:in `block (4 levels) in render'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/font.rb:102:in `font_size'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/prawn_ext/extensions.rb:254:in `font_size'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:216:in `block (3 levels) in render'
        from /usr/local/gems/pdf-core-0.5.1/lib/pdf/core/text.rb:182:in `text_rendering_mode'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:211:in `block (2 levels) in render'
        from /usr/local/gems/pdf-core-0.5.1/lib/pdf/core/text.rb:204:in `character_spacing'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:210:in `block in render'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/font.rb:208:in `save_font'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/text/formatted/box.rb:209:in `render'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:60:in `block in natural_content_height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:99:in `block in with_font'
        from /usr/local/gems/prawn-2.0.1/lib/prawn/font.rb:208:in `save_font'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:92:in `with_font'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:58:in `natural_content_height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:336:in `content_height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:309:in `height_ignoring_span'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:317:in `height'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:373:in `block in row_heights'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:369:in `each'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:369:in `row_heights'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:656:in `set_row_heights'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:148:in `initialize'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:111:in `new'
        from /usr/local/gems/prawn-table-0.2.2/lib/prawn/table.rb:111:in `table'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:1290:in `convert_table'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:71:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `block in content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `map'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/block.rb:110:in `content'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:112:in `convert_content_for_block'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:497:in `convert_open'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:71:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `block in content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `map'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `content'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:112:in `convert_content_for_block'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:323:in `convert_section'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:71:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `block in content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `map'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/abstract_block.rb:80:in `content'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/document.rb:1104:in `content'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:112:in `convert_content_for_block'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:163:in `convert_document'
        from /usr/local/gems/asciidoctor-pdf-1.5.0.alpha.12/lib/asciidoctor-pdf/converter.rb:96:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/document.rb:1044:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor.rb:1503:in `convert'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/cli/invoker.rb:94:in `block in invoke!'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/cli/invoker.rb:86:in `each'
        from /usr/local/gems/asciidoctor-1.5.4/lib/asciidoctor/cli/invoker.rb:86:in `invoke!'
        from /usr/local/gems/asciidoctor-1.5.4/bin/asciidoctor:14:in `<top (required)>'
        from /home/Thomas/bin/asciidoctor:23:in `load'
        from /home/Thomas/bin/asciidoctor:23:in `<main>'

I think the offending source causing this is probably the image inside a table cell in this file. (The proper appearance of it, in HTML, is at the top of this page. I suspect the CC-BY-ND image, but may be wrong). This image is from a URI, and I have -a allow-uri-read in the asciidoctor-pdf command line.

In any case, something basic is going wrong with processing this image, or else maybe another image, I cannot tell for sure.

This may be a known error, so just checking before I report it formally.

- thomas


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Image-in-table-cell-crashes-asciidoctor-pdf-tp4962.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux