PDF Export Header fails to render images when the filename contains spaces or special characters (URL-encoded)

XMLWordPrintable

    • Minor

      Issue Summary

      In Confluence Cloud, when customising the PDF Export Header, the PDF export engine fails to resolve image attachments if the filename contains spaces (%20), or other special characters that require URL encoding. While images with simple alphanumeric filenames (e.g., image.png) render correctly, filenames like test%20image.png or Test%20123%20image.png result in a broken image icon in the generated PDF.

      Steps to Reproduce

      1. Go to a Confluence page and attach two images to a page:
        1. Image A: header.png
        2. Image B: test image.png (Note the space in the name).
      2. Navigate to Space Settings > Look and Feel > PDF Export.
      3. In the Header section, add the HTML (see below example) using the Page ID where the images are attached.
      4. Perform a Space or Page Export to PDF.
      5. Open the resulting PDF and observe the header.
      <!-- This image will work --> 
      <img src="https://site.atlassian.net/wiki/download/attachments/PAGE_ID/header.png?api=v2">
      
      <!-- This image will fail --> 
      <img src="https://site.atlassian.net/wiki/download/attachments/PAGE_ID/test%20image.png?api=v2"

      Expected Results

      Both images should render correctly in the PDF header, as the PDF engine should be able to resolve URL-encoded paths for internal attachments.

      Actual Results

      Only the image with the simple filename (header.png) renders. The image with the encoded space (test%20image.png) fails to display, even though the URL is technically correct and accessible via a browser.

      Workaround

      1. Rename the Attachment: Rename the image file within Confluence to remove all spaces, dashes, or special characters before referencing it in the PDF Layout.
      2. Base64 Encoding: Convert the image to a Base64 string and embed it directly into the src attribute (e.g., src="data:image/png;base64,..."), which removes the dependency on URL path resolution.

              Assignee:
              Haibert Barfian
              Reporter:
              Amin A.
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: