Project

General

Profile

Actions

Defect #40763

open

Images missing from PDF Export

Added by Ewan Makepeace 5 months ago. Updated 7 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
PDF export
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

When I export to PDF almost all images are missing:

  1. PNG
  2. JPG

I have seen a couple of exceptions (the one I was just looking at was a jpg that was rendered where other jpg on the same page did not).

I attach an example screenshot, PDF and source. NOTE: This example is using {width:30%} to control image widths (something I did not even know was possible!) but I tried removing that and it made no difference.


Files

Screenshot 2024-05-31 at 13.00.17.jpg (320 KB) Screenshot 2024-05-31 at 13.00.17.jpg Ewan Makepeace, 2024-05-31 12:00
Screenshot 2024-05-31 at 13.00.06.jpg (263 KB) Screenshot 2024-05-31 at 13.00.06.jpg Ewan Makepeace, 2024-05-31 12:00
Transmute-3.pdf (98.8 KB) Transmute-3.pdf Ewan Makepeace, 2024-05-31 12:00
Actions #1

Updated by Go MAEDA 4 months ago

Could you provide images that cause the problem?

Actions #2

Updated by popy popy 7 days ago

I also experienced such issue when using ckeditor and pasting the image with CTRL-V.
The images will be populated like:

<img src="https://1.2.3.4/attachments/download/1104">

the function get_image_filename looks like this in 5.0.5:

        def get_image_filename(attrname)
          atta = RDMPdfEncoding.attach(@attachments, attrname, "UTF-8")
          if atta
            return atta.diskfile
          # rubocop:disable Lint/DuplicateBranch
          elsif %r{/attachments/download/(?<id>[^/]+)/} =~ attrname and
                atta = @attachments.find{|a| a.id.to_s == id} and
                atta.readable? and atta.visible?
            return atta.diskfile
          # rubocop:enable Lint/DuplicateBranch
          elsif %r{/attachments/thumbnail/(?<id>[^/]+)/(?<size>\d+)} =~ attrname and
                atta = @attachments.find{|a| a.id.to_s == id} and
                atta.readable? and atta.visible?
            return atta.thumbnail(size: size)
          else
            return nil
          end
        end

as you can see the line:

elsif %r{/attachments/download/(?<id>[^/]+)/} =~ attrname and

is checking for a trailing "/" (slash) which my redmine does not insert!
-> the issue occures.

To fix this i have changed the line to:

elsif %r{/attachments/download/(?<id>[^/]+)} =~ attrname and

Just removed the trailing slash.
And now it works just fine.

Here in beyond compare: https://imgur.com/a/3nEVTtb

Actions

Also available in: Atom PDF