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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old February 6th, 2013, 07:36 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,671
Default Re: Indenting a second line

Quote:
Originally Posted by n2_space View Post
Ya, I'm pretty confused Here is the original rule:



The idea is that any text in PAC1 ( or 2, or 3, or 4) that is so long it flows to the second line, is to indent it. The problem is any solution I have tried to work in that indents it causes the rows created to change size (see attached before.jpg and after.jpg ... this has dummy data in it), the lident alone in the code someone else showed me makes it do this, as with any other code I tried... so I'm rather confused.
Like I said, in order to completely analyze why you're seeing what you're seeing, I would need to run your rule myself, but it's impossible for me to do that without the rest of the job.

And again, the root of the problem is that each line has both a <br> and a <p> tag at the beginning. You need one of those, not both.
__________________
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
  #12  
Old February 6th, 2013, 07:37 AM
n2_space n2_space is offline
Regular Contributor
 
Join Date: Jul 2011
Posts: 53
Default Re: Indenting a second line

Quote:
Originally Posted by Dan Korn View Post
Like I said, in order to completely analyze why you're seeing what you're seeing, I would need to run your rule myself, but it's impossible for me to do that without the rest of the job.

And again, the root of the problem is that each line has both a <br> and a <p> tag at the beginning. You need one of those, not both.
ok, thanks for your help! I'm still learning a lot. I'll look into this further.
Reply With Quote
  #13  
Old February 6th, 2013, 09:55 AM
n2_space n2_space is offline
Regular Contributor
 
Join Date: Jul 2011
Posts: 53
Default Re: Indenting a second line

Quote:
Originally Posted by Dan Korn View Post
Or, equivalently:
Code:
var s = '<p br=false tabstops="0;1250,Left,,;" lindent=1250>•<t>';
s += [PAC1, PAC2, PAC3, PAC4].filter(String).join("<br>•<t>");
That last line says, "Make an array of these four items, remove empty elements, and join them into a single string, putting "<br>•<t>" in between each item."
Each time I try this, I get:

TypeError: [PAC1, PAC2, PAC3, PAC4].filter is not a function.

Reply With Quote
  #14  
Old February 6th, 2013, 11:06 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,671
Default Re: Indenting a second line

Quote:
Originally Posted by n2_space View Post
Each time I try this, I get:

TypeError: [PAC1, PAC2, PAC3, PAC4].filter is not a function.
Well, I guess I don't expect everyone to read all of my boring, lengthy signature, but all that stuff is there for a reason. Specifically, this is at the bottom of every message I post, in bold: "Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests."

You're obviously using a version of FusionPro prior to 8.0, which uses an older version of the JavaScript library, which doesn't support the Array.filter function. But since you never specified what version of FusionPro you're using, I assumed you were using a recent one.

Anyway, you could just use this other code instead, which, as I explicitly noted in my previous post, is equivalent to the code with the .filter function:
Code:
s = AppendText(s, '<p br=false tabstops="0;1250,Left,,;" lindent=1250>•<t>' , PAC1);
s = AppendText(s, "<br>•<t>", PAC2);
s = AppendText(s, "<br>•<t>", PAC3);
s = AppendText(s, "<br>•<t>", PAC4);
Or, if you really want to use the Array.filter function in your older version of FusionPro, you can add this into your JavaScript Globals to make it work:
Code:
if (!Array.prototype.filter)
{
  Array.prototype.filter = function(fun /*, thisp */)
  {
    "use strict";
 
    if (this == null)
      throw new TypeError();
 
    var t = Object(this);
    var len = t.length >>> 0;
    if (typeof fun != "function")
      throw new TypeError();
 
    var res = [];
    var thisp = arguments[1];
    for (var i = 0; i < len; i++)
    {
      if (i in t)
      {
        var val = t[i]; // in case fun mutates this
        if (fun.call(thisp, val, i, t))
          res.push(val);
      }
    }
 
    return res;
  };
}
The code is from here:
https://developer.mozilla.org/en-US/...#Compatibility
__________________
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
  #15  
Old February 7th, 2013, 04:54 AM
n2_space n2_space is offline
Regular Contributor
 
Join Date: Jul 2011
Posts: 53
Default Re: Indenting a second line

Quote:
Originally Posted by Dan Korn View Post
Well, I guess I don't expect everyone to read all of my boring, lengthy signature, but all that stuff is there for a reason. Specifically, this is at the bottom of every message I post, in bold: "Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests."

You're obviously using a version of FusionPro prior to 8.0, which uses an older version of the JavaScript library, which doesn't support the Array.filter function. But since you never specified what version of FusionPro you're using, I assumed you were using a recent one.

Anyway, you could just use this other code instead, which, as I explicitly noted in my previous post, is equivalent to the code with the .filter function:
Code:
s = AppendText(s, '<p br=false tabstops="0;1250,Left,,;" lindent=1250>•<t>' , PAC1);
s = AppendText(s, "<br>•<t>", PAC2);
s = AppendText(s, "<br>•<t>", PAC3);
s = AppendText(s, "<br>•<t>", PAC4);
Or, if you really want to use the Array.filter function in your older version of FusionPro, you can add this into your JavaScript Globals to make it work:
Code:
if (!Array.prototype.filter)
{
  Array.prototype.filter = function(fun /*, thisp */)
  {
    "use strict";
 
    if (this == null)
      throw new TypeError();
 
    var t = Object(this);
    var len = t.length >>> 0;
    if (typeof fun != "function")
      throw new TypeError();
 
    var res = [];
    var thisp = arguments[1];
    for (var i = 0; i < len; i++)
    {
      if (i in t)
      {
        var val = t[i]; // in case fun mutates this
        if (fun.call(thisp, val, i, t))
          res.push(val);
      }
    }
 
    return res;
  };
}
The code is from here:
https://developer.mozilla.org/en-US/...#Compatibility
yep, sorry... we've been slammed (and with another client, not even this), so my brain is in 50 places. I am using 7.2 in acrobat x... although I need to install FP 8, we have the license since we jsut bought the VDP producer server as well to automate some things.

I'll give this a whirl then, thanks!
Reply With Quote
  #16  
Old February 13th, 2013, 04:17 AM
n2_space n2_space is offline
Regular Contributor
 
Join Date: Jul 2011
Posts: 53
Default Re: Indenting a second line

Ok, I still can't get this thing to work

I've stripped some static elements of the document, just the info that is involved with dummy data, all the rules are there... this is as it was to begin with... so I am trying to figure out why many approaches to indenting the text messes up the table.

Any thoughts would be greatly appreciated as I am just flat stumped
Attached Files
File Type: pdf Derm (3).pdf (66.9 KB, 1 views)
File Type: txt ID08_sampledata.txt (426 Bytes, 1 views)
File Type: txt xdf data.txt (6.0 KB, 1 views)
__________________
9.0.3, Acrobat X
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 11:34 PM.


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