SVG Error - Undefined method `clear' for nil:NilClass
Posted by weezair on
URL: https://discuss.asciidoctor.org/SVG-Error-Undefined-method-clear-for-nil-NilClass-tp7615.html
I have an issue where asciidoctor-pdf fails to compile an .adoc with a custom theme. The compile seems to fail due to the theme's reference if an .svg for page-background-image:
page:
background-image: image:background.svg[]
It fails with the following error:
undefined method `clear' for nil:NilClass
I'm running this on a mac asciidoctor 2.0.10 with asciidoctor-pdf 1.5.0.rc.3. When I run a trace I get:
Traceback (most recent call last):
16: from /Users/chuck/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
15: from /Users/chuck/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
14: from /Users/chuck/.rvm/gems/ruby-2.6.3/bin/asciidoctor-pdf:23:in `<main>'
13: from /Users/chuck/.rvm/gems/ruby-2.6.3/bin/asciidoctor-pdf:23:in `load'
12: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-pdf-1.5.0.rc.3/bin/asciidoctor-pdf:27:in `<top (required)>'
11: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
10: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
9: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
8: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
7: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
6: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
5: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:118:in `convert'
4: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:951:in `convert'
3: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-pdf-1.5.0.rc.3/lib/asciidoctor/pdf/converter.rb:129:in `convert'
2: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-pdf-1.5.0.rc.3/lib/asciidoctor/pdf/converter.rb:186:in `convert_document'
1: from /Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-pdf-1.5.0.rc.3/lib/asciidoctor/pdf/converter.rb:2573:in `layout_title_page'
/Users/chuck/.rvm/gems/ruby-2.6.3/gems/asciidoctor-pdf-1.5.0.rc.3/lib/asciidoctor/pdf/ext/pdf-core/page.rb:46:in `reset_content': undefined method `clear' for nil:NilClass (NoMethodError)
When I replace the background.svg with a background.png file, no issues.
Interesting part is that the theme is already referencing a foreground.svg under page-foreground-image and it works fine.
I went and checked the background.svg multiple times, compared it to and even replaced it with the foreground.svg, and no luck. I tried different export .svg setting from the graphics app (Affinity Designer), even made sure the settings were the same for foreground and background files, again no luck.
Any ideas?
_*Thanks*_.