Skip to content

"showoff pdf" fails to load images #939

@silug

Description

@silug

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

  • showoff (0.20.4)
  • pdfkit (0.8.7.3)
  • ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
  • wkhtmltopdf 0.12.6

Additional Context

Based on wkhtmltopdf/wkhtmltopdf#2660 (comment), 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions