Go Back   PTI Marketing Technologies User Community > Software-Related Talk > The JavaScript Library > Graphic Rules

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 2nd, 2017, 11:20 AM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 71
Post Using Image as a Bullet in Text Frame

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:
Code:
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.
Reply With Quote
  #2  
Old March 2nd, 2017, 12:03 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 921
Default Re: Using Image as a Bullet in Text Frame

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:
Code:
if (Field("Bullet 1"))
  return Resource('bullet').content + Field("Bullet 1");
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #3  
Old March 2nd, 2017, 12:18 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 3,980
Default Re: Using Image as a Bullet in Text Frame

Quote:
Originally Posted by traba5058 View Post

I'm using the following rule:
Code:
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".
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@pti.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@PTI.com. Paid consulting work may be required to fulfill your template-building needs. Please do not post proprietary font files to this forum.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #4  
Old March 2nd, 2017, 02:29 PM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 71
Default Re: Using Image as a Bullet in Text Frame

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
Reply With Quote
  #5  
Old March 2nd, 2017, 03:06 PM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 71
Default Re: Using Image as a Bullet in Text Frame

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
Reply With Quote
  #6  
Old March 2nd, 2017, 03:09 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 921
Default Re: Using Image as a Bullet in Text Frame

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:
Code:
if (Field("Bullet 1"))
  return Resource('Bullet-Red').content.replace('/>', 'height="300" />') + Field("Bullet 1");
The above sets the height of the graphic to 3 points.
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #7  
Old March 3rd, 2017, 01:15 PM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 71
Default Re: Using Image as a Bullet in Text Frame

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?
Reply With Quote
  #8  
Old March 3rd, 2017, 03:06 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 921
Default Re: Using Image as a Bullet in Text Frame

Evenly distributing the number of bullets in each column is doable and you only need one rule to do it:
Code:
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
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Reply

Tags
bullet, image, inline

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:30 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.