jpreve Posted July 27, 2016 Share Posted July 27, 2016 FusionPro 9.3.6 | MAC OS X | DSF 9.0 I need help writing a js rule for a business card in DSF. The business card has line separators above and below the following variables: Full Name Title Line 1 Title Line 2 Email Address I need the line separators to open and close based on the title fields. The customer would like the copy to cut off if the title is too long to fit within these 2 lines. I would like the title field to be a multiple line field, instead of 2 separate fields, and allow the line graphic to change based on using 1 or 2 lines. Please see samples: 1 title line & 2 title line. Please let me know if you need any more info. Thanks!1 title line.pdf2 title line.pdf Quote Link to comment Share on other sites More sharing options...
step Posted July 28, 2016 Share Posted July 28, 2016 You could just put all of your fields into the cell of a table with a border on the top and bottom of it: var content = [ Field('Full Name'), Field('Title Line 1'), Field('Title Line 2'), Field('Email Address') ].filter(String).join('<br>'); if (!content) return ''; var table = new FPTable(); table.AddColumn(13600); var row = table.AddRow(); var cell = row.Cells[0]; cell.VAlign = 'Middle'; cell.HAlign = 'Center'; cell.SetBorders('Thin', 'PANTONE 350 U', 'Top', 'Bottom'); cell.Content = content; return table.MakeTags(); Quote Link to comment Share on other sites More sharing options...
jpreve Posted July 28, 2016 Author Share Posted July 28, 2016 That leads to another problem, I have another business card similar to it with a logo on top of the line. See attached sample. I would be fine using a graphics resource, if I knew how to keep a character limitation on the titles. There is another problem with these business cards; the phone numbers need to stay center between the bottom of the golf logo and the top of the address. For the other card the phone numbers need to stay center from the bottom line separator and the top of the address. Any suggestions on how to do this? I've been trying to wrap my head around this one for awhile now. Samples attached: Thanks for any help!!!golf 1 line title.pdfgolf 2 line title.pdf Quote Link to comment Share on other sites More sharing options...
tou Posted July 28, 2016 Share Posted July 28, 2016 (edited) With your graphics files (PDF, JPeg, Tiff, etc), if you have them premade already, you can also create the following rules: top line - text rule bottom line with graphic - text rule your textbox would be the following: <top line rule> <NAME> <TITLE> <EMAIL> <bottom line with graphic rule> Grahic rules scripting (treat return strings as tagged text): <graphic file="YOUR GRAPHIC FILE NAME/RESOURCE HERE"> Edited July 28, 2016 by tou Quote Link to comment Share on other sites More sharing options...
jpreve Posted August 2, 2016 Author Share Posted August 2, 2016 With your graphics files (PDF, JPeg, Tiff, etc), if you have them premade already, you can also create the following rules: top line - text rule bottom line with graphic - text rule your textbox would be the following: <top line rule> <NAME> <TITLE> <EMAIL> <bottom line with graphic rule> Grahic rules scripting (treat return strings as tagged text): Code: <graphic file="YOUR GRAPHIC FILE NAME/RESOURCE HERE"> I'm not sure I understand how to write the top line rule as a text rule. Can you help with this rule too? I'm a little confused on the difference between the top line rule vs. the bottom line with graphic rule? Sorry. Quote Link to comment Share on other sites More sharing options...
tou Posted August 2, 2016 Share Posted August 2, 2016 (edited) I'd parsed your business card to have only the top line for one graphic resource. Parsed the business card to have only the bottom line plus the graphic logo as another resource. I would use something like pitstop to delete components you don't need to make the two images above. Once you import the graphics as resources, you can create two separate rules to return the graphic resource (as a tagged text). This way you can then insert it into the textbox. Hard to explain, so here's the collect job....attached...golf template.zip Edited August 2, 2016 by tou Quote Link to comment Share on other sites More sharing options...
jpreve Posted August 3, 2016 Author Share Posted August 3, 2016 (edited) This works great! One more issue: What's the best way to keep the phone numbers centered between the bottom of the logo and top of the address? I'm using the paragraph formatting in the variable text editor but it's not centering it correctly. Thanks for all your help!!! JP Edited August 3, 2016 by jpreve Quote Link to comment Share on other sites More sharing options...
tou Posted August 3, 2016 Share Posted August 3, 2016 This works great! One more issue: What's the best way to keep the phone numbers centered between the bottom line and address? I'm using the paragraph formatting in the variable text editor but it's not centering it correctly. Thanks for all your help!!! JP I would imagine you create another text box and have it center vertically? Or you can have one big text box and have everything collapse blank lines when a variable is empty? Another suggestion is to format the numbers after the colon to start at the same spot....but that's just for looks of course. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.