You need to sign in to do that
Don't have an account?

How to align an image in a VF page render as PDF?
I'm trying to generate a PDF dinamically from the information we have. I managed to work this by using a VisualForce page with renderAs="pdf". The problem that we are having now is that we want an image to be center in the header, and for some reason I'm unable to make it work with standard css. Here is the part of the code i'm unsing in the page:
<apex:pageBlock >
<apex:pageBlockSection collapsible="false">
<apex:repeat value="{!pictures}" var="picture">
<div style="width:100%;">
<img src="{!URLFOR($Action.Attachment.Download, picture)}" style="display:block; margin:0 auto"/>
</div>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
If I use this desing in a plain HTML page, it works perfectly, but it seems that the apex code is messing up with my stilling.
Is there a way to make my image to be centered?
Thank you.
<apex:pageBlock >
<apex:pageBlockSection collapsible="false">
<apex:repeat value="{!pictures}" var="picture">
<div style="width:100%;">
<img src="{!URLFOR($Action.Attachment.Download, picture)}" style="display:block; margin:0 auto"/>
</div>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
If I use this desing in a plain HTML page, it works perfectly, but it seems that the apex code is messing up with my stilling.
Is there a way to make my image to be centered?
Thank you.
<apex:repeat value="{!pictures}" var="picture">
<div style="width:100%;">
<p align="center">
<img src="{!URLFOR($Action.Attachment.Download, picture)}"/>
</p>
</div>
</apex:repeat>
By doing this, my image now got centered when showing as PDF.