Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-57920

Exporting a page to PDF does not include internal images when they are added as URL

XMLWordPrintable

      Issue Summary

      Exporting a page to a PDF file doesn't render a Confluence image when the following conditions are met:

      • The image is added to the exported page by using its link, not as an attachment.
      • The Space holding the above image is not accessible to anonymous user.
        • Either by Space or Global permissions.
      • The image is still rendered in the exported page.

      Environment

      This issue was validated on multiple versions from 6.1.0 to 6.13.2.
      The described use case was still working as expected on Confluence 6.0.7.

      Steps to Reproduce

      1. Fresh install of Confluence 6.13.2.
      2. Enable Anonymous Access on Global Permissions.
        • Enable both Use Confluence and View User Profiles.
      3. Create a Space named Space Anonymous Access Enabled with Space Key SAAE.
      4. In Space SAAE enable the View permission to anonymous users.
      5. In Space SAAE, create an unrestricted page named Page with Image and attach an image to it.
      6. Create a Space named PDF Export Test with Space Key PET.
        • This space should have regular access to confluence users, but no access to anonymous.
      7. Create an unrestricted page named Export Page in Space PET.
        • This page should contain 3 images: 1) an image attached to the page; 2) an image as a link to the image attached to the same page; and 3) an image as a link to the image in Page with Image.
        • The storage format of this page will look similar to the one below.
          <p>Attached image</p>
          <p><ac:image ac:height="250"><ri:attachment ri:filename="t1_heap_before_img001.png" /></ac:image></p>
          <p><br /></p>
          <p>Link to Confluence image within the same page</p>
          <p><ac:image ac:height="250"><ri:url ri:value="http://localhost:6610/c610/download/attachments/65592/t1_heap_before_img001.png" /></ac:image></p>
          <p><br /></p>
          <p>Link to Confluence image within a Space accessible by anonymous user</p>
          <p><ac:image ac:height="250"><ri:url ri:value="http://localhost:6610/c610/download/attachments/65600/node3_heap_img001.png" /></ac:image></p>
          

      8. Export page Export Page as a PDF.

      Expected Results

      The exported PDF file should have all 3 images rendered, since all of them are accessible to the user when accessing the page from the web UI.
      The PDF file should look like this: PET-ExportPage-607.pdf

      Actual Results

      The exported PDF file does not render the image that uses the link to the image attached to Export Page.
      The PDF file looks like the following: PET-ExportPage-610.pdf

      Notes

      The problem is not related to a link to an image in the same page, but the fact that its Space does not allow anonymous access.
      However, this should not be a problem, since the user exporting the page has view access to the image.

      The below query may help the Confluence administrator to find the pages that are potentially affected by this bug and notify the page creators by e-mail:

      select c.contentid as pageID, c.title as pageTitle, s.spacekey as spaceKey, 'CONFLUENCE_BASE_URL/pages/viewpage.action?pageId=' || c.contentid as pageLink, um.username pageCreator, cu.lower_email_address as pageCreatorEmail
      from bodycontent bc
      join content c on c.contentid=bc.contentid
      join spaces s on s.spaceid=c.spaceid
      join user_mapping um on c.creator=um.user_key
      join cwd_user cu on cu.lower_user_name=um.lower_username
      where (bc.body like '%/download/thumbnails%' OR bc.body like '%/download/attachments%')
      and c.contenttype = 'PAGE'
      and c.prevver is NULL
      ;
      

      This query was validated on PostgreSQL; you may need to change it according to your database flavor.
      Change CONFLUENCE_BASE_URL to your Base URL to get accurate links to the affected pages.

      Workaround

      Instead of using a web link to the image, use the Insert a file attached to another page functionality.

      You may also use the Marketplace App Scroll PDF Exporter for Confluence, since it deals well with the scenario described in this bug report.

      As an alternative, the user can rely on browser's functionality to save the current web page as a PDF file.

        1. PET-ExportPage-607.pdf
          178 kB
        2. PET-ExportPage-610.pdf
          111 kB
        3. sample_page_img002.png
          sample_page_img002.png
          479 kB
        4. sample_page_img001.png
          sample_page_img001.png
          280 kB
        5. space_permissions_img001.png
          space_permissions_img001.png
          372 kB
        6. global_permissions_img001.png
          global_permissions_img001.png
          293 kB

              Unassigned Unassigned
              tmasutti Thiago Masutti (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: