Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. First of all, welcome to the forum! For future posts, it would be helpful if you'd include the version of FusionPro, Acrobat, OS, etc in your signature. That way someone won't offer a solution that works in one version of FP but not your particular version. Anyway, as you've discovered, impositions in FusionPro are setup per record. So you need keep in mind how many pages each record will produce when creating your imposition file. For example: if you want your job to duplex, you need to make sure that each record is producing 2 pages. And in your case: since you want each record to produce a signature, you need to make sure that each record produces a minimum of 4 pages. You might be able to get by with importing your data as an external data file and determining which pages a particular signature needs to be enabled before composing each record but that honestly seems like a huge headache. My suggestion would be to rework you data so that each record produces a signature rather than a page or as you mentioned in your original post: impose the PDF outside of FP. But without seeing the template and some sample data, it's hard to really give you a more concrete suggestion.
  2. I think what you want to do here is have two body pages since you always want two pages. And instead of setting the first text frame to "overflow" you can "connect" it to a text frame on the second body page using the chain icon. This will allow the text to flow (when needed) but will not add any additional pages if the copy does not fit (though you can apply copyfitting to the frame).
  3. Sure you can do that pretty easily: var numbers = [ Field('phone'), // phone field or rule Field('cell'), // cell field or rule Field('fax') // fax field or rule ].filter(String); var warning = "** Only 2 numbers allowed **"; // warning message return (numbers.length > 2) ? warning : numbers.join('<br>'); The above code makes use of an array ('numbers') which is compromised of 3 positions: "phone", "cell", and "fax" fields (in this example) but if you have separate rules for formatting each number, you can insert those there as well. Then the empty positions (your fields) in the array are removed using the filter method. Then, the return line is a conditional (ternary) operator that says: "if the 'numbers' array has 3 elements in it, return the warning – but if it has less than 3 elements in it, join them with a line break tag." That being said, you could also look into applying "Copyfit" to the text frame you're using to remedy your "space limitations." One final note: Java is to JavaScript as Ham is to Hamster. FusionPro rules are written in JavaScript. Java is a completely different language.
  4. Yes. You can do that a number of ways (Print, ReportError, etc) and they are all detailed on page 79 of the RuleSystemsGuide.pdf documentation (under the "FusionPro Functions" table heading). Here are some posts that relate to your question: http://forums.pti.com/showthread.php?t=33. http://forums.pti.com/showthread.php?t=3711. http://forums.pti.com/showthread.php?t=2885. But on a related note, what you've written here doesn't make sense: var CityComma =[ExternalField("City"),","].filter(String).join(''); var CSZ = [CityComma,ExternalField("St"),ExternalField("Zip")].filter(String).join(' '); Basically, you've created an array ("CityComma") of two values: 1. a "City" variable (which may or may not contain a value) 2. a static comma (,) which will always be there because it's static Then you apply the filter method to it. In this case, the filter method is checking each position of the "CityComma" array to determine if it's empty and if it is that position will be removed from the array. Finally you join the two positions (if there are still two positions) with a space. The problem being: if the "City" variable is empty, it will be removed and the resulting "CityComma" string will be: "," – which will then be inserted into the CSZ array to have the exact same thing done to it. It would make more sense to write it as: var CityComma = ExternalField("City") ? ExternalField("City") + ', ' : ''; var CSZ = [CityComma,ExternalField("St"),ExternalField("Zip")].filter(String).join(' '); Or simply: var CSZ = [ExternalField("City"),ExternalField("St"),ExternalField("Zip")].filter(String).join(' ').replace(ExternalField("City") + ' ', ExternalField("City") + ', ');
  5. Don't worry, when I devise a way to work a mention of (what looks to be) a very tall bicycle into one of my posts I will because I'm sure there's a conversation there. Anyway, I won't derail the topic any further, just wanted to thank you for sharing this information with me and the rest of the community. You were! All FusionPro text flows are wrapped with "para" tags so if you're replacing the content of one, you have to make sure you add those tags back in order for the text to display.
  6. Haha! Dan, originally the code I wrote for jwhittaker was exactly what you've posted above – down to the variable name. But, I'd previously read that page about "with" and revised my solution to get your opinion on it/how it would work within FusionPro. It just seems like it would be such a handy shorthand for all of the properties of the FusionPro object that I find myself typing so frequently. I had not, however, come across "strict mode" so I'll have to read into that page you posted here. Thank you for that.
  7. Probably the easiest thing you could do (since they don't want to copy fit at all) would be to replace the contents of your "OnCopyfit" rule with this: with (FusionPro.Composition.CurrentFlow) if (!fits) content = '<para><span color="Red">' + 'You entered too much text.</span></para>';
  8. I can't open your file because I have an older version of FusionPro than you do but the "address" array does not belong in the OnRecordStart rule. It also sounds like maybe you don't have all of your pages set to unused by default. Just to clear up any lingering confusion: This goes in OnJobStart: addressMap = new ExternalDataFileEx('2014\ er\ 2015\ October\ Branch\ Master\ List\ -\ Calendars.txt', '\t'); This goes in JavaScript Globals: addressMap = {}; addresses = []; This goes in OnRecordStart: addresses = []; // Global array of addresses var pg = 0; // Count of pages for (var i in FusionPro.Fields) { var key = Int(addressMap.FindRecord('BR #', Field(i))); if (/IB\d+/.test(i) && (key+1)) addresses[pg++] = key; } FusionPro.Composition.composeThisRecord = !!pg; FusionPro.Composition.SetBodyPageUsage(pg + "Address", true); (Notice that I've changed the code above to check that there's a record that matches the branch key before deciding on which page to use. Just in case there are some records that aren't in the external data file.) This goes in the your text rule (there are just a few changes to match the edits I made above): key = addresses.shift(); var address = ExternalField("Address"); var CSZ = [ExternalField("City"),ExternalField("St"),ExternalField("Zip")].filter(String).join(' '); address = [address,CSZ].filter(String).join('<br>'); return address || ''; //================================================== // Short hand for returning the external data values //================================================== function ExternalField(name) { return addressMap.GetFieldValue(key,name); }
  9. Sorry, I should have specified – none of the code should go in JavaScript Globals. I meant that the "addresses" array was global (notice it doesn't have 'var' in front of it). JavaScript Globals. This needs to be put in an OnRecordStart callback rule: addresses = []; // Global array of addresses var pg = 0; // Count of pages for (var i in FusionPro.Fields) { if (/IB\d+/.test(i) && Field(i)) addresses[pg++] = Field(i); } FusionPro.Composition.composeThisRecord = !!pg; FusionPro.Composition.SetBodyPageUsage(pg + 'Address', true);
  10. Thanks! I figured writing it that way would make it easily portable to other templates. And maybe it's OCD but an excessive amount of tags in a rule distract me. Well I guess I'll have to take your word for that since I can't see the actual template you're trying to apply this to or seeing how you're anticipating the output to look. Right. The page numbers will be correct but I think the interactive link that FP generates is written prior to the actual page number (after body pages are turned off) being determined. The object constructor can be re-written like this to remove the hyperlinks: //==================================================== // Generate a Table of Contents for a list of sections //==================================================== function TableOfContents() { this.sections = this.sections || []; this.section = function(title) { var sections = this.sections; if (sections.indexOf(title)+1) return ''; this.sections.push(title); return '<destination name="' + title + '">'; }; this.create = function(leader){ leader = leader || ''; if (!this.sections.length) { return ''; Print('No Sections Found'); } return this.sections.map(function(s){ var tab = '"0;' + (FindTextFrame(FusionPro.Composition.CurrentFlow.name).width - 100) + ',Right,,,' + leader + ';"'; return '<p br=false tabstops=' + tab + '><crossref name="' + s +'">' + s + '<t><$pagenum></crossref>'; }).join('<br>'); } } I'm pretty sure that bookmarks will jump to the correct pages regardless of the pages that have been turned on/off. If you wanted to make bookmarking an option in the object constructor, you could change it to: //==================================================== // Generate a Table of Contents for a list of sections //==================================================== function TableOfContents() { this.bookmarks = this.bookmarks; this.sections = this.sections || []; this.section = function(title) { var sections = this.sections; if (sections.indexOf(title)+1) return ''; this.sections.push(title); var tags = this.bookmarks ? '<p bookmarked="True">' + title + '<p>' : ''; tags +='<destination name="' + title + '">'; return tags; }; this.create = function(leader){ leader = leader || ''; if (!this.sections.length) { return ''; Print('No Sections Found'); } return this.sections.map(function(s){ var tab = '"0;' + (FindTextFrame(FusionPro.Composition.CurrentFlow.name).width - 100) + ',Right,,,' + leader + ';"'; return '<p br=false tabstops=' + tab + '><hypertext name="' + s+ '"><crossref name="' + s +'">' + s + '<t><$pagenum></crossref></hypertext>'; }).join('<br>'); } } And in OnRecordStart: toc = new TableOfContents; toc.bookmarks = true;
  11. The way I would do this is to loop through your address fields (which I've made an assumption that they are the IB## fields), and check to see if they contain data. If they contain data, push their value into a global array: addresses = []; // Global array of addresses var pg = 0; // Count of pages for (var i in FusionPro.Fields) { if (/IB\d+/.test(i) && Field(i)) addresses[pg++] = Field(i); } FusionPro.Composition.composeThisRecord = !!pg; FusionPro.Composition.SetBodyPageUsage(pg + 'Address', true); Note that if pg remains zero (aka no address records were found), the record will not be composed. Now we need to link to your external data file that you're going to use as an address map (in OnJobStart): addressMap = new ExternalDataFileEx('2014 er 2015 October Branch Master List - Calendars.txt','\t'); Then, I would set up one text rule that is set to "Re-evaluate for every text flow" and "treat returned strings as tagged text" that will return the first element in the global 'addresses' array and then splice it from the array. Then you can apply that same rule to every text frame in your template and it will return unique addresses: var [key] = addresses || ''; // If no branch found, return nothing if (!key) return '' // Remove leading zeros from Branchkey key = String(Int(key)); var address = ExternalField("Address"); var CSZ = [ExternalField("City"),ExternalField("St"),ExternalField("Zip")].filter(String).join(' '); address = [address,CSZ].filter(String).join('<br>'); // Remove the current address from the array addresses.splice(0,1); return address; //==================================== // Short hand for returning the external data values //==================================== function ExternalField(name) { return addressMap.GetFieldValue(addressMap.FindRecord('BR #', key),name); }
  12. According to this post, FP 9.3.22 supports Acrobat DC so that might help. But it appears that this user was/is experiencing the same problem as you. Full thread here: http://forums.pti.com/showthread.php?t=3982. But having said all of that, I still think your best bet would be to contact support. I don't think anyone on this forum will be able to offer you the same level of help.
  13. When you say "Compose not working" do you mean "I can't compose any job with my FusionPro installation" or "I can't get this particular job to compose?" Have you tried composing one of the tutorial jobs? If that doesn't work, you might want to try the ole' uninstall/re-install routine and reach out to support if that doesn't resolve the problem. If the tutorial composition does work, then your problem is probably specific to this particular template. That being said, I have not run into this before but at first glance, this seems odd: Maybe FP is having difficulty locating the .def file because it's on a server mount? My first suggestion would be to ensure that you have the "WIP" share mounted on the computer you're trying to compose on. If you do, is there a reason that your .def file is not located in the same directory as your template pdf? If you do a collect (FusionPro > Collect...) and try to compose from the resulting file, does that work? You may also benefit from defining a "SearchPath" in your composition settings. Good luck!
  14. Well your first issue regarding the page number can be solved by putting the "contents" in a frame that is set to overflow. Once you do that, the <$pagenum> system variable should become available to the frame that's displaying your Table of Contents. Your second issue with the links not taking you to the correct page is a direct result of turning off pages that come before the Table of Contents. Since you turned off the first 3 pages, the count is off by 3. However, if you were to move the Table of Contents, the "content" and the overflow page for the content to the front of the document (where I would imagine a Table of Contents should go), you won't run into that issue. Understand that I get that you're just giving an example but what I'm saying is that it shouldn't be a problem for you provided your "unused" pages come after your "content". With all of that said, here's how I did it: I created the following Object Constructor which can go in your JavaScript Globals: //==================================================== // Generate a Table of Contents for a list of sections //==================================================== function TableOfContents() { this.sections = this.sections || []; this.section = function(title) { var sections = this.sections; if (sections.indexOf(title)+1) return ''; this.sections.push(title); return '<destination name="' + title + '">'; }; this.create = function(leader){ leader = leader || ''; if (!this.sections.length) { return ''; Print('No Sections Found'); } return this.sections.map(function(s){ var tab = '"0;' + (FindTextFrame(FusionPro.Composition.CurrentFlow.name).width - 100) + ',Right,,,' + leader + ';"'; return '<p br=false tabstops=' + tab + '><hypertext name="' + s+ '"><crossref name="' + s +'">' + s + '<t><$pagenum></crossref></hypertext>'; }).join('<br>'); } } Then I call it from OnRecordStart: toc = new TableOfContents; Then the "Body TC Rule" rule (the rule that returns the TOC) just becomes: return toc.create([color="Red"]'.'[/color]); Note that the "create" function accepts a parameter (highlighted in red) that defines a "leader" character for the tab between section title and page number. Also note that "Re-evaluate after every text flow" and "Treat returned strings as tagged text" are both checked. Then "Destination Rule" becomes (for example): var sections = []; // Section 1 var section1 = toc.section('Section 1') + "SECTION1" + '<br>' + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam posuere nisi in tortor sagittis dictum. Vivamus iaculis ornare neque, eu vehicula orci efficitur id. Fusce pellentesque malesuada purus id cursus. Nam quis nulla porttitor, lacinia ligula nec, porta purus. Morbi in metus est. Morbi ultricies, dui eget pharetra porta, nisl risus ultrices tortor, nec blandit turpis eros eu erat. Proin vel enim mauris. Mauris vulputate volutpat nisi eget porttitor.<br>Ut non pulvinar nisl, eget blandit enim. Integer tempor porttitor diam, in efficitur ligula elementum eget. Nam nulla enim, cursus id sagittis vel, mattis et felis. Maecenas ut lorem urna. Cras fermentum ligula in erat cursus elementum. Integer posuere nisi lobortis eros pharetra aliquam. Duis pellentesque turpis nec felis sagittis dictum. Ut mattis, mi nec aliquam porta, leo odio aliquam arcu, id ultricies neque turpis at ipsum. Donec vel urna nibh. Nullam tempus orci tincidunt tortor iaculis feugiat. Maecenas dictum, libero eget congue lobortis, erat odio eleifend nulla, id sagittis purus sem ut eros. Donec egestas consectetur dolor molestie feugiat. Donec rutrum, ante a mattis efficitur, mauris magna ultricies elit, vitae congue orci lectus vitae quam.<br>Sed vel ligula sed nunc consectetur semper. Morbi quis accumsan justo. Aliquam sit amet nisi eu libero finibus condimentum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam posuere vitae ligula pretium facilisis. Vivamus eu quam et eros dictum suscipit. Suspendisse libero augue, venenatis suscipit elit sit amet, ultricies mattis quam. Aenean faucibus nec augue at auctor. Curabitur pharetra ligula a ex lobortis vulputate.<br>Vivamus turpis enim, tincidunt vitae sollicitudin a, pellentesque in velit. Suspendisse nec fringilla neque. Donec tempus, ligula eu finibus aliquam, dolor metus blandit magna, in vestibulum nisi purus vitae nisl. Donec suscipit in metus eu placerat. Proin quis malesuada turpis. Suspendisse eget elit quis lectus ornare cursus. Morbi sed porta metus. Nam non metus id purus ultrices dignissim a vitae sapien. Duis porttitor porttitor feugiat. In hendrerit dolor nunc, quis facilisis erat varius et. Vivamus dignissim arcu porttitor dui ullamcorper aliquet.'; // Section 2 var section2 = toc.section('Section 2') + "SECTION 2" + '<br>' + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam posuere nisi in tortor sagittis dictum. Vivamus iaculis ornare neque, eu vehicula orci efficitur id. Fusce pellentesque malesuada purus id cursus. Nam quis nulla porttitor, lacinia ligula nec, porta purus. Morbi in metus est. Morbi ultricies, dui eget pharetra porta, nisl risus ultrices tortor, nec blandit turpis eros eu erat. Proin vel enim mauris. Mauris vulputate volutpat nisi eget porttitor.<br>Ut non pulvinar nisl, eget blandit enim. Integer tempor porttitor diam, in efficitur ligula elementum eget. Nam nulla enim, cursus id sagittis vel, mattis et felis. Maecenas ut lorem urna. Cras fermentum ligula in erat cursus elementum. Integer posuere nisi lobortis eros pharetra aliquam. Duis pellentesque turpis nec felis sagittis dictum. Ut mattis, mi nec aliquam porta, leo odio aliquam arcu, id ultricies neque turpis at ipsum. Donec vel urna nibh. Nullam tempus orci tincidunt tortor iaculis feugiat. Maecenas dictum, libero eget congue lobortis, erat odio eleifend nulla, id sagittis purus sem ut eros. Donec egestas consectetur dolor molestie feugiat. Donec rutrum, ante a mattis efficitur, mauris magna ultricies elit, vitae congue orci lectus vitae quam.<br>Sed vel ligula sed nunc consectetur semper. Morbi quis accumsan justo. Aliquam sit amet nisi eu libero finibus condimentum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam posuere vitae ligula pretium facilisis. Vivamus eu quam et eros dictum suscipit. Suspendisse libero augue, venenatis suscipit elit sit amet, ultricies mattis quam. Aenean faucibus nec augue at auctor. Curabitur pharetra ligula a ex lobortis vulputate.<br>Vivamus turpis enim, tincidunt vitae sollicitudin a, pellentesque in velit. Suspendisse nec fringilla neque. Donec tempus, ligula eu finibus aliquam, dolor metus blandit magna, in vestibulum nisi purus vitae nisl. Donec suscipit in metus eu placerat. Proin quis malesuada turpis. Suspendisse eget elit quis lectus ornare cursus. Morbi sed porta metus. Nam non metus id purus ultrices dignissim a vitae sapien. Duis porttitor porttitor feugiat. In hendrerit dolor nunc, quis facilisis erat varius et. Vivamus dignissim arcu porttitor dui ullamcorper aliquet.'; // Section 3 (Pulled from a rule) var section3 = Rule("section3"); sections.push(section1,section2,section3); return sections.join('<page destination="topofpage">'); Noting that the "section" function tags the destination and requires that the parameter passed be the name of the section. You can also pull in sections generated in other rules (as demonstrated above). This rule should not be set to re-evaluate during every flow. I realize that might be a little hard to follow so I've attached an example as well. Good luck! TOC_Ste.zip
  15. Gregg, I'm not exactly sure why this would be the case, but I think tags are the culprit here. You can try doing something like this in OnRecordStart to see if you get better results: var frame = FindTextFrame('main text frame'); frame.content = frame.content.replace(/<\/para>/g,'<br>'); Also, don't forget that you can turn on copy-fitting for those linked frames and the same magnification factor will be applied to all of them.
  16. I wonder if the conversion is happening elsewhere in your DSF – prior to the data being processed by the TaggedDataField function. If that were the case, the first ampersand in "&" would be converted to the same entity and give the appearance that it wasn't being properly converted to raw text. With that in mind, you could try to account for that: function NoBreak(s) { return s.replace(/&/g,'&').replace(/ /g, " "); } return NoBreak(TaggedDataField("title")); Or maybe: function NoBreak(s) { return RawTextFromTagged(s).replace(/&/g,'&').replace(/ /g, " "); } return NoBreak(TaggedDataField("title"));
  17. That's part of the issue with passing the width as a parameter to the function that I wrote. If you don't actually specify margins, there aren't any defaults. I mean there are clearly margins in the table cells that we can see but there is not a default value in the FPTable object that we can access and account for. Which means that this value will always be 0 and the width being passed as a parameter to the 'breakText' function will always be the exact width of the cell (because cell.Margins isn't defined): var margins = 0; if (cell.Margins) { margins += cell.Margins.Left || 0; margins += cell.Margins.Right || 0; } As far as margins not working well with Overflow pages, I think that ties into to legacy line leading but I know what you're saying. This goes back to what I was saying. You're esscentially estimating that the margins take up about 28.5 pts of the entire width and passing the difference to the function. I'm glad you found something that's working! One word of caution though about that approach: calling that function on a per row basis (and as a result running though that for loop and while loop) could increase your composition time.
  18. Sounds like it's time for a Chicago trip!
  19. You can make 3 separate phone formatting rules for each number and call them like this: // Number logos: var cellImg = Resource("cell").content; var phoneImg = Resource("phone").content; var faxImg = Resource("fax").content; // Number offset from baseline var offset = 50; var result = []; var numbers = [[cellImg, [color="Red"]Rule('cell')[/color]],[phoneImg, [color="red"]Rule('phone')[/color]],[faxImg, [color="red"]Rule('fax')[/color]]]; for (var i in numbers) if (numbers[i][1]) result.push(numbers[i][0] + '<p br=false superoffset=' + offset + ' superratio=100><superscript> ' + numbers[i][1] + '</superscript>'); return result.join('<br>'); Or you could do create a function to format the numbers and do this: // Number logos: var cellImg = Resource("cell").content; var phoneImg = Resource("phone").content; var faxImg = Resource("fax").content; // Number offset from baseline var offset = 50; var result = []; var numbers = [[cellImg, Field('cell')],[phoneImg, Field('phone')],[faxImg, Field('fax')]]; for (var i in numbers) if (numbers[i][1]) result.push(numbers[i][0] + '<p br=false superoffset=' + offset + ' superratio=100><superscript> ' + [color="red"]formatNumber(numbers[i][1])[/color] + '</superscript>'); return result.join('<br>'); // Format Phone Number [color="red"]function formatNumber(number){ var number = Trim(number); var pattern01 = /^(\d{3})[^\d]*(\d{4})$/; var pattern02 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; var pattern03 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; var pattern04 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; var pattern05 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; var pattern06 = /^(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; var patternEndExt = /(.)[x#n](.)/; var patternStart1 = /^[\D]*[1]/; if(number.match(pattern01)){ number = number.replace(pattern01, "$1.$2"); return number; } else if(number.match(pattern02)){ number = number.replace(pattern02, "$1.$2.$3"); return number; } else if(number.match(pattern03)){ if (number.match(patternStart1)){ number = number.replace(pattern03, "+$1 $2.$3.$4"); return number; } else { return number; } } else if(number.match(pattern04)){ number = number.replace(pattern04, "$1.$2.$3 ext.$4"); return number; } else if(number.match(pattern05)){ number = number.replace(pattern05, "+$1 $2.$3.$4 ext.$5"); return number; } else if(number.match(pattern06)){ number = number.replace(pattern06, "$1.$2 ext.$3"); return number; } else { //return "no match any pattern"; return number; } }[/color]
  20. If you've got margins (specifically left and right) those will need to be accounted for in the width. Keeping in mind that left and right margins are measured in 100th's of a point while top and bottom are measured in 10th's of a point. Also, if you're setting your top and bottom margin to 0 like I was, try setting them to something like 10. I don't think tables honor horizontal margins that are set to 0. Can you post an example of the code that's building your table and a sample name that doesn't fit? The other thing I would recommend would be turning off "legacy line leading" if you don't need it. That seems to have some kind of odd affect on table margins especially in tighter cells. I noticed that my original code was adding a break tag to the end of the line as well which may have had yielded some non-desirable results. I've made a few changes that might work better (in red): function breakText(input,cellWidth){ var tm = new FusionProTextMeasure; tm.pointSize = "12 pt"; tm.font = "Helvetica"; tm.maxWidth = cellWidth; tm.CalculateTextExtent(input); var breaks = tm.textLines-1; if (!breaks) return input; [color="Red"]input = input.match(new RegExp('(.{' + Math.floor(input.length/breaks) + '})','g')) || []; return input.join('<br>');[/color] } // Example Table: var w = 6300; // 7/8" var field = 'asdqwertyuiopasdfghjasdqwertyuiopasdfghj'; // Your field var table = new FPTable(); table.AddColumn(w); var row = table.AddRow(); var cell = row.Cells[0]; [color="red"]cell.Margins = {Top:10, Bottom:10, Left: 100,Right: 100};[/color] cell.SetBorders('Thin','Black','Left','Right','Top','Bottom'); [color="red"]var margins = 0; if (cell.Margins) { margins += cell.Margins.Left || 0; margins += cell.Margins.Right || 0; }[/color] row.SetContents( breakText(field, [color="red"]w-margins[/color]) ); return table.MakeTags();
  21. The way I would do it is: find out how many lines your field is going to require (using TextMeasure) and if it requires more than 1 line, insert line breaks into your string in order to give you the resulting number of lines. For example: if your field is 30 characters long and takes up 3 lines, insert a line break every 10th character. function breakText(input,cellWidth){ var tm = new FusionProTextMeasure; tm.pointSize = "12 pt"; tm.font = "Helvetica"; tm.maxWidth = cellWidth; tm.CalculateTextExtent(input); var breaks = tm.textLines-1; if (!breaks) return input; return input.replace(new RegExp('(.{' + input.length/breaks + '})','g'),'$1<br>'); } var w = 6300; // 7/8" var field = 'asdqwertyuiopasdfghjasdqwertyuiopasdfghj'; // Your field var table = new FPTable(); table.AddColumn(w); var row = table.AddRow(); var cell = row.Cells[0]; cell.Margins = {Top:0, Bottom:0, Left:0, Right:0}; cell.SetBorders('Thin','Black','Left','Right','Top','Bottom'); row.SetContents( breakText(field,w) ); return table.MakeTags();
  22. That pretty accurately describes every printer/client relationship. "Wait, those have been there the last 10 times they've printed this for us? Well, that's completely unacceptable all of a sudden."
  23. The exclamation points (!) are the start and stop symbols used in 3 of 9 barcodes. But if you're sure you want to remove them: Create a new text rule (with "treat returned strings as tagged text" checked): return Rule("3 of 9 Barcode Rule").replace(/!/g,''); And insert that rule into your text frame instead of the "3 of 9 Barcode Rule."
  24. You could add space to the right side of the graphic itself, you could add a non-breaking space ( ), or you could add a tab and set the spacing by adjusting your tab-stops. Here's an example of adding a non-breaking space: // Number logos: var cellImg = Resource("cell").content; var phoneImg = Resource("phone").content; var faxImg = Resource("fax").content; // Number offset from baseline var offset = 50; var result = []; var numbers = [[cellImg, Field('cell')],[phoneImg, Field('phone')],[faxImg, Field('fax')]]; for (var i in numbers) if (numbers[i][1]) result.push(numbers[i][0] + '<p br=false superoffset=' + offset + ' superratio=100><superscript>[color="Red"] [/color]' + numbers[i][1] + '</superscript>'); return result.join('<br>');
×
×
  • Create New...