You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment the converter seems to assume local files
gems/kramdown-converter-pdf-1.0.5/lib/kramdown/converter/pdf.rb:158:in `initialize': No such file or directory @ rb_sysopen - ./https://miro.medium.com/max/1036/1*wHKe6W4opLmk6pb7sxZz6w.png (Errno::ENOENT)
The text was updated successfully, but these errors were encountered:
Try2Code
changed the title
images as provided as links
images provided as links
Mar 17, 2022
This gems does work well with URL. But there's a rescue and retry that would hide the first error, which is the one you're probably trying to fix @Try2Code .
See the code:
img_dirs = @options.fetch(:image_directories, []) + ["."]
path_or_url = img.attr["src"]
begin
image_obj, image_info = @pdf.build_image_object(open(path_or_url))
rescue StandardError => e
puts "ERROR: #{e}"
raise if img_dirs.empty?
path_or_url = File.join(img_dirs.shift, img.attr["src"])
retry
end
On the first try your open call is likely failing. Then it rescue the error, change the path_or_url variable joining the img_dirs content and try again. Given that img_dirs will always have a "." it sounds like the error is related to the fact that ConverterPdf is looking locally for a URL, but that's false. Looking locally by joining the img_dirs is just a fallback in case the URL fails.
I had the same problem, and adding a little bit of extra logging I could figure out what was my issue. In my case, the external image was returning a 404.
begin
image_obj, image_info = @pdf.build_image_object(open(path_or_url))
rescue StandardError => e
puts "ERROR: #{e}" # Extra logging
raise if img_dirs.empty?
path_or_url = File.join(img_dirs.shift, img.attr["src"])
retry
end
hi!
I would like to know if there is a way to convert markdown to pdf with inline images like
At the moment the converter seems to assume local files
The text was updated successfully, but these errors were encountered: