Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > Getting Started

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 13th, 2011, 09:50 AM
rsager rsager is offline
Junior Community Member
 
Join Date: Mar 2011
Location: Valley Forge, PA
Posts: 15
Default Adjust graphic to line of text

I am trying to create an inline graphics rule that will adjust the width of a tif file to the length of my Fname, MI, Lname and Education Fields in a business card template. If the name line has 19 characters the lines.tif will match the width of characters. I think I am on the right track but I am having some trouble setting it up. Can this be done as an inline graphics rule?
Reply With Quote
  #2  
Old April 14th, 2011, 08:51 AM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: Adjust graphic to line of text

I've never done anything like that before, but at a glance it seems like this could be handled with the TextMeasure object. I haven't tried the following code, but perhaps it will at least get you started:
Code:
var myText = Field("Fname") + " " + Field("MI") + " " + Field("Lname") + ", " + Field("Education");

var tm = new FusionProTextMeasure;

// CHANGE THESE TO MATCH YOUR TEXT ATTRIBUTES
tm.pointSize = "12 pt";
tm.font = "Arial";
tm.bold = true;
tm.useTags = false;
tm.CalculateTextExtent(myText)

var graphicWidth = tm.textWidth;
var result = <graphic file=\"lines.tif\" width=graphicWidth>;
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
  #3  
Old April 14th, 2011, 09:21 AM
rsager rsager is offline
Junior Community Member
 
Join Date: Mar 2011
Location: Valley Forge, PA
Posts: 15
Default Re: Adjust graphic to line of text

Thanks Eric,
Shawn was able to help me out. Created a Rule called Inline Graphic Rule. Here is the code.

wholeGroup='<p style="(no style)" br="false" override="true" quad="C" findent="0" lindent="0" rindent="0" leadbefore="0" leadafter="0" widows="2" kerning="true" hyphenate="true" skipifempty="false" skipifemptyvar="false" noparabreakoncopyfit="false"><tracking newsize="0.000000"><f name="Palatino Black"><z newsize="18.0"><color name="Black"><b><variable name="FName"> <variable name="MI"> <variable name="LName">, <variable name="Education">';
TM = new FusionProTextMeasure;
TM.CalculateTextExtent(wholeGroup);
myTM=TM.textWidth;
return '<graphic file="lines.tif" width="'+myTM+'" height="3675">';
Reply With Quote
Reply

Tags
image, inline graphics, text

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 08:32 PM.


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