Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Producer (formerly FusionPro® Direct)

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 1st, 2013, 12:44 PM
Meir Meir is offline
Regular Contributor
 
Join Date: Mar 2011
Location: Lawrenceville, NJ
Posts: 50
Question How To Control Where Line Breaks?

I am working on a business card that has very specific design specifications. One of the specifications is if the email cannot fit on one line, to drop the @... to the next line.

short@client.com would fit on one line but

reallyreallyreallyreallylong@client.com would display as

reallyreallyreallyreallylong
@client.com

Is there a way to set where the line breaks? In this case, set it to break before the @ symbol.

Thank you.
__________________
Meir Galimidi
Allegra
FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0
Reply With Quote
  #2  
Old May 1st, 2013, 01:01 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: How To Control Where Line Breaks?

You can give this a shot:
Code:
// Use TextMeasure to get the length of each company name
var tm = new FusionProTextMeasure;
var frameWidth = 2; // set width of the text box (in inches)
tm.pointSize = "10 pt"; // set the type size
tm.font = "Helvetica"; // set your typeface
var str = Field("Email"); // set the field to use
tm.CalculateTextExtent(str);
tm.useTags = false;
var tmWidth = tm.textWidth;

return (tmWidth < frameWidth*7200) ? str : str.replace("@", "<br>@");
__________________
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 May 1st, 2013, 01:17 PM
Meir Meir is offline
Regular Contributor
 
Join Date: Mar 2011
Location: Lawrenceville, NJ
Posts: 50
Talking Re: How To Control Where Line Breaks?

Thank you very much. That worked great!
__________________
Meir Galimidi
Allegra
FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0
Reply With Quote
  #4  
Old May 1st, 2013, 02:36 PM
Meir Meir is offline
Regular Contributor
 
Join Date: Mar 2011
Location: Lawrenceville, NJ
Posts: 50
Default Re: How To Control Where Line Breaks?

I ran into an error trying to make a more complicated version of that. When I did it with the email field, it worked fine.

Now I am trying to adapt it to work with multiple fields.

I need it to determine if a line made up of first last credential1, credential2, credential3, credential 4 is wider than the text box.

If so, I need it to break the line after the first name, so the last name starts a new line.

I tried this:

Code:
var frameWidth = 1.62; // set width of the text box (in inches)

// Use TextMeasure to get the length of each company name
var names = new FusionProTextMeasure;
names.pointSize = "9 pt"; // set the type size
names.font = "Bosis Bold"; // set your typeface
var strnames = Field("First")+" "+Field("Last"); // set the field to use
names.CalculateTextExtent(strnames);
names.useTags = false;
var namesWidth = names.textWidth;

// Use TextMeasure to get the length of each company name
var credential = new FusionProTextMeasure;
credential.pointSize = "9 pt"; // set the type size
credential.font = "Bosis Light"; // set your typeface
var strcredential = " "+Rule("Credential Rule"); // set the field to use
credential.CalculateTextExtent(strcredential);
credential.useTags = false;
var credentialWidth = credential.textWidth;


return (namesWidth+credentialWidth < frameWidth*7200) ? strnames : strnames.splice(" ", "<br>");
However, this is returning "{Name Copyfit Rule}" rather than the name.
__________________
Meir Galimidi
Allegra
FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0
Reply With Quote
  #5  
Old May 1st, 2013, 02:44 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,359
Default Re: How To Control Where Line Breaks?

Quote:
Originally Posted by Meir View Post
However, this is returning "{Name Copyfit Rule}" rather than the name.
You should see the error when you validate the rule in the Rule Editor, and also in the .msg file when you do a regular composition (not a Preview).
__________________
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@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

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
  #6  
Old May 1st, 2013, 03:10 PM
Meir Meir is offline
Regular Contributor
 
Join Date: Mar 2011
Location: Lawrenceville, NJ
Posts: 50
Default Re: How To Control Where Line Breaks?

when I validate in the rule editor, it gives me the result I want.

When I compose, I get this error
Quote:
Name Copyfit Rule, line 22: TypeError: strnames.splice is not a function
Composing record #1, input record 1
Value for variable Name Copyfit Rule not found in instance data
So I figured out it was because I replaced 'str.replace' with 'strnames.splice'.

Thank you.
__________________
Meir Galimidi
Allegra
FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0
Reply With Quote
Reply

Tags
copyfit, copyfitline, fusion pro, line break

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 10:11 AM.


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