Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Formatting Text

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 7th, 2017, 12:52 PM
jl_arnold jl_arnold is offline
Regular Contributor
 
Join Date: Jun 2016
Posts: 53
Default Flowing text with Multiple front/back options

I have a simple two page newsletter, front and back.

Users will choose one of three design options for the front, and one of three options from the back.

Text flows from the main area on the front to the main text area on the back.


I'm at the point where I am setting up the text flow.

On page 1, the text frame is named "MainArticleBodyCopy".
The text frames on back are "BackBodyCopy", "BackBodyCopy2" and "BackBodyCopy3".

I am trying to figure out how to setup the flow so that a user selects Front-1 and Back-2 (BackBodyCopy2), that these text boxes are linked.


The problem I am having is that I can only link one frame to one frame. So after I setup "MainArticleBodyCopy" to "BackBodyCopy2", it loses the link to "BackBodyCopy"


The only way I can think to accomplish what I need would be to copy the MainArticleBodyCopy frame three times, and rename it. Then link one frame to the BackBodyCopy, another frame to BackBodyCopy2 and the Third layered frame to BackBodyCopy3. Then I would repeat this on Front-2. If I do this, I would have 3 MainArticleBodyCopy on pages 1-3 and 9 BackBodyCopy frames on each of the back three pages.


Is there another (or better) way to do this? I have attached my collected zip file.

Thanks!
Attached Files
File Type: zip CCHMC Newsletter_BluePurple_FINAL.zip (4.97 MB, 9 views)
Reply With Quote
  #2  
Old June 9th, 2017, 05:05 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,369
Default Re: Flowing text with Multiple front/back options

Quote:
Originally Posted by jl_arnold View Post
I am trying to figure out how to setup the flow so that a user selects Front-1 and Back-2 (BackBodyCopy2), that these text boxes are linked.

The problem I am having is that I can only link one frame to one frame. So after I setup "MainArticleBodyCopy" to "BackBodyCopy2", it loses the link to "BackBodyCopy"
Yes, you can link a text frame to only one other text frame.

Are there really nine different possible combinations?
  • Front 1, Back 1
  • Front 1, Back 2
  • Front 1, Back 3
  • Front 2, Back 1
  • Front 2, Back 2
  • Front 2, Back 3
  • Front 3, Back 1
  • Front 3, Back 2
  • Front 3, Back 3
Quote:
Originally Posted by jl_arnold View Post
The only way I can think to accomplish what I need would be to copy the MainArticleBodyCopy frame three times, and rename it. Then link one frame to the BackBodyCopy, another frame to BackBodyCopy2 and the Third layered frame to BackBodyCopy3. Then I would repeat this on Front-2. If I do this, I would have 3 MainArticleBodyCopy on pages 1-3 and 9 BackBodyCopy frames on each of the back three pages.

Is there another (or better) way to do this?
Yes. One way would be to have three different copies of each of the "MainArticleBodyCopy" frames on each of the three "front" pages, and three copies of each of the each "BackBodyCopy" frames on each of the three "back" pages, each of which is connected in a set. So on page "Front-1", you would have these frames, connected to back page frames like so:
  • "MainArticleBodyCopy1-Back1" -> "BackBodyCopy1-1"
  • "MainArticleBodyCopy1-Back2" -> "BackBodyCopy1-2"
  • "MainArticleBodyCopy1-Back3" -> "BackBodyCopy1-3"
And on page "Front-2", you would have:
  • "MainArticleBodyCopy2-Back1" -> "BackBodyCopy2-1"
  • "MainArticleBodyCopy2-Back2" -> "BackBodyCopy2-2"
  • "MainArticleBodyCopy2-Back3" -> "BackBodyCopy2-3"
And on page "Front-3":
  • "MainArticleBodyCopy3-Back1" -> "BackBodyCopy3-1"
  • "MainArticleBodyCopy3-Back2" -> "BackBodyCopy3-2"
  • "MainArticleBodyCopy3-Back3" -> "BackBodyCopy3-3"
Then, assuming that the data fields have values like "Front-1" etc., you need to do this in OnRecordStart:
Code:
var frontNum = Field("Front Design").slice(-1);
var backNum = Field("Back Design").slice(-1);
for (var f = 1; f <= 2; f++)
{
    for (var b = 1; b <= 2; b++)
    {
        var enable = (f == frontNum && b == backNum);
        FindTextFrame("MainArticleBodyCopy" + f + "-Back" + b).suppress = !enable;
        FindTextFrame("BackBodyCopy" + f + "-" + b).suppress = !enable;
    }
}
There are other possibilities, depending on how much the layouts of all of the pages vary. If you are composing with FusionPro VDP Producer or Server, or via a web-to-print app utilizing FP Server (such as MarcomCentral), then you could theoretically only have one front and one back page, and change the positions of the frames on each page with JavaScript.

By the way, I see that you finally took my advice about the "single line" frames and gave up trying to copyfit them.

Also, if you set all of your pages to be unused, then your entire OnRecordStart rule (other than the code I suggest above) can be reduced to this:
Code:
FusionPro.Composition.SetBodyPageUsage(Field("Front Design"), true);
FusionPro.Composition.SetBodyPageUsage(Field("Back Design"), true);
Except for these last six lines, which do absolutely nothing, since FusionPro.Composition.CurrentFlow is not set at that time that OnRecordStart is called:
Code:
if (FusionPro.Composition.CurrentFlow.name == "MiscNewsletterInfo")
{
FindTextFrame("MiscNewsletterInfo").textWrap = false;
}
if (FusionPro.Composition.CurrentFlow.name == "MiscNewsletterInfo2")
{
FindTextFrame("MiscNewsletterInfo2").textWrap = false;
}
The right way to do that would be just:
Code:
FindTextFrame("MiscNewsletterInfo").textWrap = false;
FindTextFrame("MiscNewsletterInfo2").textWrap = false;
Although you don't even need to do that, since text wrap is already turned off for those frames (in the Text Frame Properties palette).

Finally, many of your rules seem to define exactly the same "replaceFunction" function. It's not clear to me what this function does, but but you could paste it just once into the JavaScript Globals and remove all the other copies from the other rules.
__________________
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
  #3  
Old June 12th, 2017, 06:30 AM
jl_arnold jl_arnold is offline
Regular Contributor
 
Join Date: Jun 2016
Posts: 53
Default Re: Flowing text with Multiple front/back options

Quote:
Finally, many of your rules seem to define exactly the same "replaceFunction" function. It's not clear to me what this function does, but but you could paste it just once into the JavaScript Globals and remove all the other copies from the other rules.
That's great to know! I had tried to figure out a way to apply this to all fields easily but was not able to get it to work properly. This rule converts single and double quotes to typographer quotes and is used for all fields (even number only fields... per client request).



Quote:
Except for these last six lines, which do absolutely nothing, since FusionPro.Composition.CurrentFlow is not set at that time that OnRecordStart is called:
Code:
if (FusionPro.Composition.CurrentFlow.name == "MiscNewsletterInfo") { FindTextFrame("MiscNewsletterInfo").textWrap = false; } if (FusionPro.Composition.CurrentFlow.name == "MiscNewsletterInfo2") { FindTextFrame("MiscNewsletterInfo2").textWrap = false; }
The right way to do that would be just:
Code:
FindTextFrame("MiscNewsletterInfo").textWrap = false; FindTextFrame("MiscNewsletterInfo2").textWrap = false;
Although you don't even need to do that, since text wrap is already turned off for those frames (in the Text Frame Properties palette).

The last nine rules in OnRecordStart was meant to suppress the unused frames, the same with the code you have provided. The Text Wrap is trying to set textwrapping for the linked frames. The back option #3 (page 6) has an photo and a text frame. I was trying to get the text to wrap around the photo and text so that copyfitting will work appropriately, instead of just moving the photo and text to the front layer.

Is it possible to set textWrap to true for linked frames?


I'm also not having much success with the suppression rule you provided. I feel like I only need a portion of the code since linking the frames converts the BackBodyCopy frames to MainArticleBodyCopy1-3.

Code:
        FindTextFrame("MainArticleBodyCopy" + f + "-" + b).suppress = !enable;
and delete:
Code:
FindTextFrame("BackBodyCopy" + f + "-" + b).suppress = !enable;
I can tell that text is not suppressed because the output files contains darker text on the front page, due to the multiple layers on the first page. But I'm not sure why it's not working. Any suggestions?

Thanks!
Jason
Reply With Quote
  #4  
Old June 12th, 2017, 11:56 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,369
Default Re: Flowing text with Multiple front/back options

Quote:
Originally Posted by jl_arnold View Post
The last nine rules in OnRecordStart was meant to suppress the unused frames, the same with the code you have provided. The Text Wrap is trying to set textwrapping for the linked frames. The back option #3 (page 6) has an photo and a text frame. I was trying to get the text to wrap around the photo and text so that copyfitting will work appropriately, instead of just moving the photo and text to the front layer.
I don't understand. The frames you want to wrap around are already on the top layer. All you need to do is select each frame, and for each, click the Text Wrap button, right in the middle of the Frame Properties palette. You don't need any JavaScript.
Quote:
Originally Posted by jl_arnold View Post
Is it possible to set textWrap to true for linked frames?
Yes, as I describe just above.
Quote:
Originally Posted by jl_arnold View Post
I'm also not having much success with the suppression rule you provided. I feel like I only need a portion of the code since linking the frames converts the BackBodyCopy frames to MainArticleBodyCopy1-3.
Sorry, but again, I don't understand what you're saying. How does linking the frames "convert" anything?
Quote:
Originally Posted by jl_arnold View Post
I can tell that text is not suppressed because the output files contains darker text on the front page, due to the multiple layers on the first page. But I'm not sure why it's not working. Any suggestions?
I don't understand how you can tell whether a frame is suppressed by how dark some text is. I would try putting a border or fill on the frame so that it's easier to tell when it's suppressed.
__________________
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
  #5  
Old June 12th, 2017, 12:15 PM
jl_arnold jl_arnold is offline
Regular Contributor
 
Join Date: Jun 2016
Posts: 53
Default Re: Flowing text with Multiple front/back options

Quote:
Re: Flowing text with Multiple front/back options
Quote:
Originally Posted by jl_arnold
The last nine rules in OnRecordStart was meant to suppress the unused frames, the same with the code you have provided. The Text Wrap is trying to set textwrapping for the linked frames. The back option #3 (page 6) has an photo and a text frame. I was trying to get the text to wrap around the photo and text so that copyfitting will work appropriately, instead of just moving the photo and text to the front layer.

I don't understand. The frames you want to wrap around are already on the top layer. All you need to do is select each frame, and for each, click the Text Wrap button, right in the middle of the Frame Properties palette. You don't need any JavaScript.

For some reason, when I link the frames, it turns the textwrap button off.



As for the text, it's at 80% black, so when I download the press proof, I select the text and delete it, but it's still there. So I select it and delete it again, and it's still there. Finally after the text appears 80% black onscreen (which it may only be an onscreen issue), and if I delete this text, the all MainArticleBodyCopy on the first page gets deleted.

So suppression isn't working because of the three layers of text on the first page.

So I'm not sure what to fix.

Code:
var frontNum = Field("Front Design").slice(-1, -1);
var backNum = Field("Back Design").slice(-1, -1);
for (var f = 1; f <= 2; f++)
{
    for (var b = 1; b <= 2; b++)
    {
        var enable = (f == frontNum && b == backNum);
        FindTextFrame("MainArticleBodyCopy" + f + "-" + b).suppress = !enable;
    }
}
I modified the code about as all pages are named Front-1, Front-2, Front-3, Back-1, Back-2, Back-3 and all frames are named MainArticleBodyCopy1-1 and all nine combinations through MainArticleBodyCopy3-3.

Thanks!
Reply With Quote
  #6  
Old June 12th, 2017, 01:34 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,369
Default Re: Flowing text with Multiple front/back options

Quote:
Originally Posted by jl_arnold View Post
For some reason, when I link the frames, it turns the textwrap button off.
There may be a bug where that button shows that text wrap is off even when it's on. Previewing the output should show you whether it's working or not.

At any rate, there's nothing preventing you from placing an extra empty text or graphic frame on the page and setting its text wrap. The Frodo Travel tutorial shows an example of this.
Quote:
Originally Posted by jl_arnold View Post
As for the text, it's at 80% black, so when I download the press proof, I select the text and delete it, but it's still there. So I select it and delete it again, and it's still there. Finally after the text appears 80% black onscreen (which it may only be an onscreen issue), and if I delete this text, the all MainArticleBodyCopy on the first page gets deleted.

So suppression isn't working because of the three layers of text on the first page.
Perhaps it's working in some of the layers but you're still seeing text from the other layers? Again, try setting a different color fill on each frame, and even moving them to different positions, to see which ones actually are showing up and which are being suppressed. Once you get the suppression logic right, you can remove all the fills and put everything back.
Quote:
Originally Posted by jl_arnold View Post
So I'm not sure what to fix.
I'm not sure either, without seeing the updated template files.
__________________
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
Reply

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 04:48 PM.


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