Jump to content

Using Image as a Bullet in Text Frame


traba5058

Recommended Posts

I'm creating a template for a customer that allows users to select up to 5 bullets. Based upon the number of bullets they flow to the next frame.

 

I have that working.

 

In addition to the above, they want to use an image as a bullet. (see attached bullet)Bullet-Red-c12m100y99k3.pdf

 

I'm using the following rule:

if (Field("Bullet 1") != "")
return "<graphic file=Bullet-Red-c12m100y99k3.pdf>"+ Field("Bullet 1");
else return ""

 

When I test the rule it shows that it is returning the graphic + the text. When I apply the rule it is only showing the text.

 

I deselected return as tagged text & it placed the following in the text box:

 

<graphic file=Bullet-Red-c12m100y99k3.pdf>Bullet Copy.

 

I know that I can use graphic boxes for the bullets & text boxes for the copy (and align them), but some bullets are 1 line & some are 2 lines so the spacing between them will not be uniform. This is why I'm trying to use inline graphic.

 

Also, on 2 line bullets, the bullet needs to display on line 1. I've also attached a PDF showing how the bullets should display. PrintAd-4x4-r1.pdf

 

I hope someone can help me today.

Link to comment
Share on other sites

Your code looks good so I'm assuming the location of the bullet file isn't in FP's search path. You could define the path or add the path to FusionPro's search path (under the "Advanced" tab of the composition settings). But perhaps the easiest solution would be to add the file as a resource named "bullet" and change your code to:

if (Field("Bullet 1"))
 return Resource('bullet').content + Field("Bullet 1");

Link to comment
Share on other sites

 

I'm using the following rule:

if (Field("Bullet 1") != "")
return "<graphic file=Bullet-Red-c12m100y99k3.pdf>"+ Field("Bullet 1");
else return ""

When I test the rule it shows that it is returning the graphic + the text. When I apply the rule it is only showing the text.

 

I deselected return as tagged text & it placed the following in the text box:

 

<graphic file=Bullet-Red-c12m100y99k3.pdf>Bullet Copy.

Check the box "Treat returned strings as tagged markup".

Link to comment
Share on other sites

Thanks to both of you!

 

The updated code you provided did work (I already had a resource named Bullet-Red), so i used that.

 

Now I have 1 more question. The bullet is too big. Is there a way I can scale it or give it a set size?

 

Let me know.

Thanks!

Traba

Link to comment
Share on other sites

Stephen,

 

This goes along with my last post.

 

I have 2 more questions, so 3 in total:

 

1.) Size the bullet image

2.) Add space between the bullet & text

3.) Indent line 2 when it wraps

 

I've trying everything in the Tags reference manual but can't get them formatted correctly.

 

Thanks,

Traba

Link to comment
Share on other sites

Yeah, of course. You can define "width" and "height" properties (both defined in 100ths of a point). If you define one without the other, the missing attribute will be scaled proportionally:

if (Field("Bullet 1"))
 return Resource('Bullet-Red').content[color="Red"].replace('/>', 'height="300" />')[/color] + Field("Bullet 1");

The above sets the height of the graphic to 3 points.

Link to comment
Share on other sites

Thanks so much! That worked perfectly.

 

I have one more question about this. They have 5 bullets (some are one line & some are two lines) that flow between 2 text boxes that are linked.

 

Right now, I have the 5 bullet rules (like the one you helped me with) and I placed them in box 1 using the text frame settings box.

 

Is there are way to setup the rule so that if there is an even number of bullets it distributes them evenly between the text frames?

Link to comment
Share on other sites

Evenly distributing the number of bullets in each column is doable and you only need one rule to do it:

return [
 Field("Bullet 1"),
 Field("Bullet 2"),
 Field("Bullet 3"),
 Field("Bullet 4"),
 Field("Bullet 5")
].filter(String).map(function(s,p,a) { 
 var res = '';
 if (p == Math.ceil(a.length/2))
   res += '<p verticalstart="topofcolumn">';
 res += Resource('Bullet-Red').content.replace('/>', 'height="300" />') + s;
 return res;
}).join('<br>');

That being said, as evident in the example you originally posted, there are more factors that come into play when trying to evenly distribute the columns. Just because you have two bullets on the left and two bullets on the right you aren't guaranteed that the left and right columns will be even (which I'm assuming is your goal). Take a look at this thread and see if it helps http://forums.pti.com/showthread.php?t=4423

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...