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

Export to PDF, Centered Images are not included in .pdf file

      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      PDF Exports of wiki page with centered images don't include images.

      Steps to reproduce:

      1. Create a page and insert an image jpg, png etc...
      2. Export the page to PDF. You should see that the image(s) did export.
      3. Edit the page and align the image to the center.
      4. Export the page to PDF again.
        Expected result: Image shows in the center.
        Actual result: Image is not displayed.

      Cause:
      The alignment done using the image tags is not being exported:

      This is the "Storage Format" of a centered image that is not exported to PDF:

      <p><ac:image ac:align="center"><ri:attachment ri:filename="image.jpg"><ri:page ri:content-title="Images Page" ri:space-key="KB" /></ri:attachment></ac:image></p>
      

      and this is the one of an image centered by using the workaround and is exported to PDF (without alignment)

      <p style="text-align: center;"><ac:image><ri:attachment ri:filename="image.jpg"><ri:page ri:content-title="Images Page" ri:space-key="KB" /></ri:attachment></ac:image></p>
      

      Workaround:
      center-align the cursor before including the image to the page.
      The image will be added in the center and will be displayed in PDF exports.

            [CONFSERVER-35945] Export to PDF, Centered Images are not included in .pdf file

            Minh Tran added a comment - - edited

            A fix for this issue is available to Server and Data Center customers in Confluence 6.13.0
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            Minh Tran added a comment - - edited A fix for this issue is available to Server and Data Center customers in Confluence 6.13.0 Upgrade now or check out the Release Notes to see what other issues are resolved.

            We found a pretty and smart solution for pictures that are either not centered or aligned to the right!

            Append the following code to your PDF stylesheet:

            span.confluence-embedded-file-wrapper {   
                display: inline-block !important;  
            } 
            

            If not just images are affected, but other spans, you can embed the following:

            p[style="text-align: center;"] span.confluence-embedded-file-wrapper,  
            p[style="text-align: right;"] span.confluence-embedded-file-wrapper 
             {   
                display: inline-block !important;  
            }  
            

            Issue Description

            The actual issue is about the <span> tag that wraps the image. After centering an image with the editor, you have a construct like

            <p style="text-align: center;"><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" src="/xsystem/download/attachments/344041801/Koala.jpg?version=1&amp;modificationDate=1448543356520&amp;api=v2" data-image-src="/xsystem/download/attachments/344041801/Koala.jpg?version=1&amp;modificationDate=1448543356520&amp;api=v2" data-unresolved-comment-count="0" data-linked-resource-id="382009443" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="Koala.jpg" data-base-url="https://*/xsystem" data-linked-resource-content-type="image/jpeg" data-linked-resource-container-id="344041801" data-linked-resource-container-version="15" height="250"></span></p>
            

            The style 'text-align:center' will not be applied to the <img> tag due to the span tag which has this missing property: "display:inline-block;"

            Please note

            Please note that this fix works only, if the image is really centred (also on editor UI). So, you have to go to edit mode an see if the 'align:center' button is selected when selecting the image. You can also verify this by using a browser developer plugin (e.g. firebug) and inspecting the image element. It has to be wrapped by a span tag which is again wrapped by '<p style="text-align: center;">'.

            For some reasons, this is sometimes not the case. I also had the behaviour after centring the image that this <p style="text-align: center;"> is not added to the image. However, on the regular view mode in both cases, images are centred. For me, this is an open issue @Atlassian

            @Atlassian: Please provide this fix in an upcoming version!

            Jens Kasperek (Bosch GmbH) (Inactive) added a comment - We found a pretty and smart solution for pictures that are either not centered or aligned to the right! Append the following code to your PDF stylesheet: span.confluence-embedded-file-wrapper { display: inline-block !important; } If not just images are affected, but other spans, you can embed the following: p[style= "text-align: center;" ] span.confluence-embedded-file-wrapper, p[style= "text-align: right;" ] span.confluence-embedded-file-wrapper { display: inline-block !important; } Issue Description The actual issue is about the <span> tag that wraps the image. After centering an image with the editor, you have a construct like <p style= "text-align: center;" > <span class= "confluence-embedded-file-wrapper confluence-embedded-manual-size" > <img class= "confluence-embedded-image" src= "/xsystem/download/attachments/344041801/Koala.jpg?version=1&amp;modificationDate=1448543356520&amp;api=v2" data-image-src= "/xsystem/download/attachments/344041801/Koala.jpg?version=1&amp;modificationDate=1448543356520&amp;api=v2" data-unresolved-comment-count= "0" data-linked-resource-id= "382009443" data-linked-resource-version= "1" data-linked-resource-type= "attachment" data-linked-resource-default-alias= "Koala.jpg" data-base-url= "https://*/xsystem" data-linked-resource-content-type= "image/jpeg" data-linked-resource-container-id= "344041801" data-linked-resource-container-version= "15" height= "250" > </span> </p> The style 'text-align:center' will not be applied to the <img> tag due to the span tag which has this missing property: "display:inline-block;" Please note Please note that this fix works only, if the image is really centred (also on editor UI). So, you have to go to edit mode an see if the 'align:center' button is selected when selecting the image. You can also verify this by using a browser developer plugin (e.g. firebug) and inspecting the image element. It has to be wrapped by a span tag which is again wrapped by '<p style="text-align: center;">'. For some reasons, this is sometimes not the case. I also had the behaviour after centring the image that this <p style="text-align: center;"> is not added to the image. However, on the regular view mode in both cases, images are centred. For me, this is an open issue @Atlassian @Atlassian: Please provide this fix in an upcoming version!

            Shannon S added a comment - - edited

            ltran I tried the workaround myself, but the PDF still shows the image on the left side, even if we align it.

            Do you have any information on why this might be? How can we get the images to be centered?

            Shannon S added a comment - - edited ltran I tried the workaround myself, but the PDF still shows the image on the left side, even if we align it. Do you have any information on why this might be? How can we get the images to be centered?

            Hi Paul

            Thanks for the update on this and providing the extra information. We're going to take a further look at this to see what's occurring here.

            Regards
            Steve Haffenden
            Confluence bugmaster

            Steve Haffenden (Inactive) added a comment - Hi Paul Thanks for the update on this and providing the extra information. We're going to take a further look at this to see what's occurring here. Regards Steve Haffenden Confluence bugmaster

            Steve:

            I am using the onDemand (Now Atlassian Cloud) version which appears to be 5.6.4.
            This problem was NOT there on Nov 26, 2014, but suddenly appeared sometime in December 2014.
            The bug you assigned it CONF-32451 was reported against 5.3.4 in Jan 2014, and it appears no one has addressed it. In my opinion they seem to be not related since the issue was not there last month.

            This is a serious issue with pdf rendering since now all images Center align, no longer appear in the PDF output.

            I have many Wiki pages which have Centered aligned JPG and PNG files and obtain PDF files from them for our product documentation. It is very difficult for us to go back to each image and align them left.

            If the pdf rendering module/software/plugin has changed for the onDemand version in the last month, is there a way for us to use the older one?

            Thanks

            Paul Brandariz added a comment - Steve: I am using the onDemand (Now Atlassian Cloud) version which appears to be 5.6.4. This problem was NOT there on Nov 26, 2014, but suddenly appeared sometime in December 2014. The bug you assigned it CONF-32451 was reported against 5.3.4 in Jan 2014, and it appears no one has addressed it. In my opinion they seem to be not related since the issue was not there last month. This is a serious issue with pdf rendering since now all images Center align, no longer appear in the PDF output. I have many Wiki pages which have Centered aligned JPG and PNG files and obtain PDF files from them for our product documentation. It is very difficult for us to go back to each image and align them left. If the pdf rendering module/software/plugin has changed for the onDemand version in the last month, is there a way for us to use the older one? Thanks

            Hi jrobison

            Thanks for taking the time to raise this issue. From the description that you've provided I believe that the root cause of this issue is the same as for CONF-32451. As such I'm going to close this issue out as a duplicate.

            Regards
            Steve Haffenden
            Confluence Bugmaster

            Steve Haffenden (Inactive) added a comment - Hi jrobison Thanks for taking the time to raise this issue. From the description that you've provided I believe that the root cause of this issue is the same as for CONF-32451 . As such I'm going to close this issue out as a duplicate. Regards Steve Haffenden Confluence Bugmaster

              mbereznitsky Mark Bereznitsky
              jrobison1 JordanA
              Affected customers:
              37 This affects my team
              Watchers:
              35 Start watching this issue

                Created:
                Updated:
                Resolved: