Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to center all pictures on a page once?

maria liseenkova September 27, 2018

I usually use the tool on the user panel to center each picture. It is more or less fine, but I have problems while pdf export. Some of the pictures a left centered. I don`t know why. Sometimes I use html command "text-align: center" for a picture, it helps but not for every picture.  On the confluence page it is centered, everything is fine.

Is there any command to make all the pictures centered and have them the same after pdf exporting? Or it is possible to solve this problem using some tools?

1 answer

1 vote
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2018

One tool to help diagnosis the issue is the confluence-source-editor. This tool will allow you to look at the XHTML source of the page to see if the images that are not centering on PDF export are some how inserted differently than other, for example, inside div or span tags, or non-breaking spaces ahead of the image, etc.

If you see differences, but not sure what to do, you can paste the code here, both one that centers and one that does not. Then we (the community) can try to give you more guidance.

maria liseenkova September 27, 2018

2 cases are attached below (pdf output and the source codes). On the confluence page all the pictures are centered. 

1 in pdf.png1.png2 in pdf.png2.png

maria liseenkova September 27, 2018

I see only one way – leave empty line between text and picture and center this line. It works. Is there any other way?

Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2018

One thing that sticks out at me is that the images look like they were pasted into the Confluence page, rather than linked to either an attachment on the page or another page within Confluence. I have seen strange behavior with pasted images.

For example, this is what I would have expected to see for an image correctly inserted and centered

<p>
  <ac:image ac:align="center" ac:height="436" ac:width="593">
    <ri:attachment ri:filename="worddavae7a5f7d81588469b7c82fa3b8a63ce1.png"/>
  </ac:image>
</p>

In the first instance, I see you have text in front of the image, followed by <br> tag before the ac::image tag -- that will cause problems. So it should appear as:

<p>a bunch of text ... (<<RESET>>)</p>
<p>
  <ac:image ac:align="center">
    <ri:url ri:value="...."/>
  </ac:image>
</p>

The reason the second instance worked was because the parent p tag was also centered aligned.

<p style="text-align:center;">a bunch of text ... )<br>
  <ac:image ac:align="center">
    <ri:url ri:value="...."/>
  </ac:image>
</p>

Hope this helps.

maria liseenkova October 1, 2018

Thank you for your reply!

I`ll try to find a proper way to insert pics. Some of the pictures were imported with the document from a word file. I found pictures with the same code as you wrote, but they had the same problem with centering in pdf. I guess <p> value is a priority for pdf exporter, so pictures have the same characteristics as a text above. I started to make a new line, then insert a picture. It works. For now I see this as the only way. 

Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2018

If if works, please give a vote or accept the answer, please. ;-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events