Placing an image on a page based on a condition

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
pviscogl
Propeller Head
Posts: 16
Joined: Wed Sep 14, 2011 6:11 am

Placing an image on a page based on a condition

Post by pviscogl »

Hi all,
I am looking to find a good way to have an image on the right of a title, that I would be able to choose depending on context. This is to insert an icon, when needed, to state the type of content inside of a specific page of a PDF output. The example below shows an icon that is inserted because the page contains a specific content.


My first idea was to insert all icons in a div (for example) and put a condition on each image so I can use a topic condition to display which image i want on each page. Any other ideas? Also, how would you position the image itself. I think float does not work well in pdf?
thank you,
Pascal
ajturnersurrey
Sr. Propeller Head
Posts: 346
Joined: Fri Nov 05, 2010 3:30 am

Re: Placing an image on a page based on a condition

Post by ajturnersurrey »

These are not pretty, but they might just help. I used two approaches in one project several years ago, which needed rendering as html5 help and pdfs. I'm not sure which type is most relevant to you, so I include both.

1.Some headings required large images - they needed a div and I kept the image over to the right hand edge, rather than following directly from the heading text for easier management
image with heading.jpg

Code: Select all

<div class="heading_with_img">
            <h2 MadCap:autonum="1.1  ">
                <img class="heading_icon_wide" src="../Resources/Images/xxxxxxxxx.png"/>
                Title goes here xxxxxxx</h2>
        </div>
Where the css needed for print media was:

Code: Select all

div.heading_with_img
{
	margin: 0;
	padding: 0;
	overflow: hidden;
	height: auto;
}
img.heading_icon_wide
{
	position: absolute;
	float: none;
	z-index: 2;
	clear: none;
	visibility: hidden;
	width: 1in;
	left: 5.25in;
	padding: 0;
	margin: 0;
	top: -0.05in;
}
2. Headings requiring one or two small images following the heading text. These could be conditioned to only show under certain conditions. Like you I had thought I might insert all 5 every time and condition some out, or maybe grey some out, but I found that the choice of images was so tied to the topic that in the end it made more sense to put the right ones in with each heading and not mess around with conditions.
small image with heading.jpg

Code: Select all

<h2 MadCap:autonum="1.1  ">
             Title goes here xxxxxxxxxxxxxxxxx
             <img class="ECM_permission" src="../Resources/Images/xxxxxxxxxxxx.png" />
             <img class="ECM_permission2" src="../Resources/Images/xxxxxxxxxxxx.png" /></h2>
Where the css needed for print media was:

Code: Select all

img.ECM_permission
{
		padding: 1mm;
		right: 0;
		margin-right: 0;
		height: 0.2in;
		position: static;
		top: -0.25in;
		float: none;
		margin-left: 0;
}

img.ECM_permission2
{
		float: none;
		height: 0.2in;
		margin-right: 0;
		position: static;
		right: 0;
		left: 0.25in;
		top: -0.4in;
		margin-bottom: 0.025in;
}
You do not have the required permissions to view the files attached to this post.
pviscogl
Propeller Head
Posts: 16
Joined: Wed Sep 14, 2011 6:11 am

Re: Placing an image on a page based on a condition

Post by pviscogl »

Thank you ajturnersurrey
This is exactly what I am trying to do... This definitely helps. I'll try this.
Post Reply