binford2k / showoff

Don't just present; interact with your audience!
http://binford2k.github.io/showoff
MIT License
938 stars 502 forks source link

"showoff pdf" fails to load images #939

Open silug opened 1 year ago

silug commented 1 year ago

Describe the Bug

showoff pdf fails with the following error:

Exit with code 1 due to network error: ProtocolUnknownError

A PDF is created with no images.

Expected Behavior

PDF should include images.

Steps to Reproduce

Steps to reproduce the behavior:

  1. showoff pdf

Environment

Additional Context

Based on https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2660#issuecomment-663063752, I made the following modification:

--- showoff-0.20.4/lib/showoff_utils.rb.orig    2023-06-12 14:18:03.602606733 -0500
+++ showoff-0.20.4/lib/showoff_utils.rb 2023-06-12 14:18:08.807586825 -0500
@@ -570,7 +570,7 @@
   end

   def self.showoff_pdf_options(dir = '.')
-    opts = get_config_option(dir, 'pdf_options', {:page_size => 'Letter', :orientation => 'Landscape', :print_media_type => true})
+    opts = get_config_option(dir, 'pdf_options', {:page_size => 'Letter', :orientation => 'Landscape', :print_media_type => true, :enable_local_file_access => true})
     Hash[opts.map {|k, v| [k.to_sym, v]}] # keys must be symbols
   end

This seems to fix image loading.