Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. Oh, I didn't notice that because I didn't actually compose the job (just previewed) when I was initially looking at it. That is a great question. I honestly have no idea. My guess is that it has to do with the custom leading that's being applied to the various elements not carrying over to the overflow page.
  2. Lisa, if go to the text frames that you're using to return the table, highlight all of the text, click "paragraph", and check the box beside "suppress if empty," do you get the results you're looking for?
  3. You can do this by repeating the record 250 times. Add this line of code to an OnRecordStart Callback rule: FusionPro.Composition.repeatRecordCount = 250; Then you need to create a blank text rule that will return your sequence number: var seq = Field("Start Number"); // Replace with the field name of the starting number var result = (Int(seq) - 1) + FusionPro.Composition.repeatRecordNumber; return result;
  4. Even though you're bringing them into a text frame, they are still being pulled in as graphics using a graphic tag. Another option would be to set up a hot folder scenario and use a tool such as pdftk to combine the PDFs from the command line using this syntax: pdftk old1.pdf old2.pdf old3.pdf cat new.pdf Then, you could use Watchdog to run the script on a specific folder every 24 hours. I hear ya on that but sometimes I find it easier to look at in acrobat than in the tiny window on screen (despite the rasterization). Yes, there are other ways to import PDFs into a document (using a graphic frame for example), but ultimately, you'll still be importing a graphic into your template which will result in a large file size.
  5. My guess would be that since you're pulling in the PDFs as graphics into FusionPro, they are viewed as such and cannot be compressed as they could be in Acrobat. You could try making a JLYT or PPML file out of FusionPro but I think you'll run into the same size issue. I think the best way to reduce file size would be to bypass FP all together for this step and just combine the PDFs in Acrobat. Using "File > Create > Combine Files into a Single PDF" and dropping all of the PDFs you wish to combine into that window. Just a note about the Indigo: you can preview the imported files on screen or you can create a PDF of the job for better resolution/viewing by right-clicking on a job and clicking "composition preview"
  6. I think it has to do with using the right indent. If you left justify your text box, remove the email rule from it, you can simplify things a bit by modifying your "Test_testbox" rule to look like this: var frameWidth = 1.89 * 7200; // 1.89 inches var email = "email: " + ToLower(Field("Email")); var cell = "cell: " + Rule("Cellphone_Format"); // Email Size var emailTM = new FusionProTextMeasure; emailTM.pointSize = "6 pt"; emailTM.font = "Helvetica"; emailTM.useTags = false; emailTM.italic = true; emailTM.CalculateTextExtent(email); var indent = frameWidth-emailTM.textWidth; return "<p findent=" + indent + ">" + cell + "</p><br><p findent=" + indent + ">" + email + "</p>"; It's essentially indenting the email address to be right aligned and indents the cellphone number the same amount (from the left). Copyfit works with those modifications.
  7. I suppose you could use the FusionProTextMeasure tool (here's a good example) to determine if that line is too long to fit in the text box, and if it is, insert a break ('<br>') before the last inline graphic in order to keep the graphic beside the text on the next line.
  8. Your code looks like you're using a non-breaking space and a space. You should take that space out: <z newsize="9"><b>www.website1.com - www.website2.com - <graphic file="E:\dsf_vdp_data\DAM\IMAGES\cc_fb.pdf"> MyFacebook - <graphic file="E:\dsf_vdp_data\DAM\IMAGES\cc_tw.pdf"> MyTwitter</b></magnify>
  9. Okay, sorry I misread your original post and didn't see an extension in the data file you included. You can edit your phone number rules to replace all spaces with non-breaking spaces and that could solve your problem. (The change is in red. And make sure you check "treat returned strings as tagged text" in the rule editor) var Var1 = "Phone1"; var CaseSelection = "Format 3"; if(CaseSelection == "Format 1") { var formatStyle01 = "$1.$2"; //simple 7 digit phone var formatStyle02 = "$1.$2.$3"; //simple 10 digit phone var formatStyle03 = "+$1 $2.$3.$4"; //10 digit phone starts with 1 var formatStyle04 = "$1.$2.$3 ext.$4"; //10 digit phone with extension var formatStyle05 = "+$1 $2.$3.$4 ext.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1.$2 ext.$3"; //7 digit phone with extension var thisNumber = Field(Var1); return formatNumber(Trim(thisNumber)); } if(CaseSelection == "Format 2") { var formatStyle01 = "$1-$2"; //simple 7 digit phone var formatStyle02 = "$1-$2-$3"; //simple 10 digit phone var formatStyle03 = "+$1 $2-$3-$4"; //10 digit phone starts with 1 var formatStyle04 = "$1-$2-$3 ext.$4"; //10 digit phone with extension var formatStyle05 = "+$1 $2-$3-$4 ext.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1-$2 ext.$3"; //7 digit phone with extension var thisNumber = Field(Var1); return formatNumber(Trim(thisNumber)); } if(CaseSelection == "Format 3") { var formatStyle01 = "$1-$2"; //simple 7 digit phone var formatStyle02 = "($1) $2-$3"; //simple 10 digit phone var formatStyle03 = "+$1 ($2) $3-$4"; //10 digit phone starts with 1 var formatStyle04 = "($1) $2-$3 ext.$4"; //10 digit phone with extension var formatStyle05 = "+$1 ($2) $3-$4 ext.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1-$2 ext.$3"; //7 digit phone with extension var thisNumber = Field(Var1); return formatNumber(Trim(thisNumber))[color="Red"].replace(/\s/g," ")[/color]; } if(CaseSelection == "Format 4") { var formatStyle01 = "$1.$2"; //simple 7 digit phone var formatStyle02 = "($1)$2.$3"; //simple 10 digit phone var formatStyle03 = "+$1 ($2)$3.$4"; //10 digit phone starts with 1 var formatStyle04 = "($1)$2.$3 ext.$4"; //10 digit phone with extension var formatStyle05 = "+$1 ($2)$3.$4 ext.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1.$2 ext.$3"; //7 digit phone with extension var thisNumber = Field(Var1); return formatNumber(Trim(thisNumber)); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // DO NOT EDIT BELOW THIS LINE /////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// return formatNumber(Trim(thisNumber)); function formatNumber(number01){ var pattern01 = /^(\d{3})[^\d]*(\d{4})$/; // //2201727 or 220-1727 or 220- 1727 var pattern02 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; // 8002201727 or 800-220-1727 or (800)220-1727 or (800) 220-1727 var pattern03 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; // 18002201727 or 1-800-220-1727 or +1 (800) 220-1727 var pattern04 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; // 800-220-1727 ext 12345 or (800) 220-1727 ext 12345 var pattern05 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; // 1-800-220-1727 ext 12345 or +1 (800) 220-1727 ext 12345 var pattern06 = /^(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; // 2201727 ext 1234 or 220-1727 ext 1234 or 220- 1727 ext 1234 var patternEndExt = /(.)[x#n](.)/; var patternStart1 = /^[\D]*[1]/; if(number01.match(pattern01)){ number01 = number01.replace(pattern01, formatStyle01); return number01; } else if(number01.match(pattern02)){ number01 = number01.replace(pattern02, formatStyle02); return number01; } else if(number01.match(pattern03)){ if (number01.match(patternStart1)){ number01 = number01.replace(pattern03, formatStyle03); return number01; } else { return number01; } } else if(number01.match(pattern04)){ number01 = number01.replace(pattern04, formatStyle04); return number01; } else if(number01.match(pattern05)){ number01 = number01.replace(pattern05, formatStyle05); return number01; } else if(number01.match(pattern06)){ number01 = number01.replace(pattern06, formatStyle06); return number01; } else { //return "no match any pattern"; return number01; } }
  10. Do a select all (cmd + A) on the text in that text box, click paragraph, and then click "suppress if empty" and select OK.
  11. If you setup your graphics to be named to match the description of the item (which is what it seems like you were saying you wanted to do), you should be able to add another column in your table and populate it with an image of your product by making these changes to your existing code (in red): var XDF = new ExternalDataFileEx("95069_List.csv", "\,"); var firstItemColumn = 13; // "Apple Computers & Monitors" var myTable = new FPTable; myTable.AddColumns([color="red"]4900,[/color]4800, 28800, 4800); for (var row = firstItemColumn; row <= XDF.fieldCount; row++) { var itemCount = Int(XDF.GetFieldValue(CurrentRecordNumber(), row)); if (itemCount) { var thisRow = myTable.AddRow(); for (var cell = 0; cell < myTable.Columns.length; cell++) { var thisCell = thisRow.Cells[cell]; thisCell.SetBorders("Thin","Black","Top","Bottom","Right","Left"); thisCell.HAlign = "Center"; thisCell.Margins = { Top:40, Bottom:40 }; } var header = XDF.GetFieldValue(0, row); thisRow.SetContents([color="Red"]'<graphic file="/path/to/graphics/' + header.substr(3) + '.tiff" width="4100">', [/color]header.substr(0,2), header.substr(3), itemCount); } } return myTable.MakeTags();
  12. Thomas's solution would work as well as long as you are not planning on imposing out of FP. Applying a saddle stitched imposition to that solution will not give you the correct imposition because it's technically only 1 record being repeated 'x' number of times.
  13. You can use inline graphics in a table. It would be easier to help you, though, if you could collect your template and data to give the forum a better understanding of what you're looking to accomplish.
  14. I would do this by utilizing an overflow page to pull in the PDFs (found here). Then I'd modify that code so that it would pull in everything up until the last page (1-27 in a 28 page document). Then have a second body page that pulls in the last page of the PDF (page 28) with a text frame on it that displays the address block. I've uploaded an example that I built to get you started. test_template.zip
  15. Try this: var redPMS = "Red"; // The name of the red color in your template (phone labels) var blackPMS = "Black"; // The name of the black color in your template (numbers) var phone1 = Field("phone"); // Replace with your field name var phone2 = Field("direct"); // Replace with your field name var phone3 = Field("mobile"); // Replace with your field name var label1 = "p"; var label2 = "d"; var label3 = "m"; // Array of numbers and labels var numbers = [[label1,phone1],[label2,phone2],[label3,phone3]]; // Remove elements that don't have a phone number from the array numbers = numbers.filter(function(s){return s[1];}); // Add color tags, format numbers, & add a pipe ( | ) between labels/numbers for (var i=0; i<numbers.length; i++){ numbers[i][0] = '<color name="'+ blackPMS +'">' + numbers[i][0] + '</color>'; numbers[i][1] = '<color name="'+ blackPMS +'">' + formatPhone(numbers[i][1]) + '</color>'; numbers[i] = numbers[i].join('<color name="'+ redPMS +'"> | </color>'); } // Join with a line break return numbers.join("<br>"); //=============================================================== // // DON'T EDIT BELOW THIS LINE // //=============================================================== function formatPhone(num){ var Var1 = num; var formatStyle01 = "$1.$2"; //simple 7 digit phone var formatStyle02 = "$1.$2.$3"; //simple 10 digit phone var formatStyle03 = "+$1 $2.$3.$4"; //10 digit phone starts with 1 var formatStyle04 = "$1.$2.$3 ext.$4"; //10 digit phone with extension var formatStyle05 = "+$1 $2.$3.$4 ext.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1.$2 ext.$3"; //7 digit phone with extension var thisNumber = Var1; return formatNumber(Trim(thisNumber)); function formatNumber(number01){ 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(number01.match(pattern01)){ number01 = number01.replace(pattern01, formatStyle01); return number01; } else if(number01.match(pattern02)){ number01 = number01.replace(pattern02, formatStyle02); return number01; } else if(number01.match(pattern03)){ if (number01.match(patternStart1)){ number01 = number01.replace(pattern03, formatStyle03); return number01; } else { return number01; } } else if(number01.match(pattern04)){ number01 = number01.replace(pattern04, formatStyle04); return number01; } else if(number01.match(pattern05)){ number01 = number01.replace(pattern05, formatStyle05); return number01; } else if(number01.match(pattern06)){ number01 = number01.replace(pattern06, formatStyle06); return number01; } else { return number01; } } }
  16. Oh sorry I didn't realize that you were superscripting the text. That makes more sense considering (apparently) you can't superscript an inline graphic. Sorry about that suggestion - I didn't test it since I assumed that's what you were doing. I think you could take what you've got and add something like this for the tab stop: var name = Field("Name"); var designation = Field("Designation"); var result = ""; var tmName = new FusionProTextMeasure; tmName.pointSize = "12"; // point size of name tmName.font = "Myriad Pro Bold"; // font for name tmName.useTags = true; var tmDesig = new FusionProTextMeasure; tmDesig.pointSize = "7"; // point size for designations tmDesig.font = "Myriad Pro"; // font for designations tmDesig.useTags = true; tmName.CalculateTextExtent(name + ", "); tmDesig.CalculateTextExtent(designation); [color="Red"]var tab = '<p br="false" findent="' + (tmName.textWidth + tmDesig.textWidth) + '">' var graphic = '<graphic file="CCA_Gold_Seal.eps">'; return = tab + graphic;[/color]
  17. Michelle, I think you were on the right track by superscripting the incline graphic. You can adjust the offset percentage and ratio of the superscript with paragraph tags like this: '<p br=false superoffset=45 superratio=100><superscript><graphic file="name.jpg"></superscript>'; After looking at your sample, I think you'd actually probably need to subscript the inline graphic since the baseline is lower than that of the text. The same logic works for subscripting: '<p br=false suboffset=45 subratio=100><subscript><graphic file="name.jpg"></subscript>'; Check out the Tags Reference Guide for more information.
  18. Hi Dawn, I think the simplest thing would be to get rid of all of those rules and just have one rule to format that line of numbers for you. The code below contains an array of your numbers and labels. If a number is blank in the data, it removes it and its associated label from the array. Then, it adds color tags around the labels and numbers (joining them with a single space) and formats the number using part of FP's format number rule which I've added as a function at the bottom of the rule (beneath the comment that says "do not edit below this line"). It then joins the entire array with 5 spaces as you've specified. To make it work for you, create a blank rule and copy and paste the code into it. Edit the lines of code where I've instructed in the comments to reflect your field names and color names, and make sure you have "treat returned strings as tagged text" checked. var redPMS = "Red"; // The name of the red color in your template (phone labels) var blackPMS = "Black"; // The name of the black color in your template (numbers) var officeField = Field("office"); // Replace with your field name var mobileField = Field("mobile"); // Replace with your field name var faxField = Field("fax"); // Replace with your field name // Array of numbers and tags var numbers = [["office",officeField],["mobile",mobileField],["fax",faxField]]; // Remove elements that don't have a phone number from the array numbers = numbers.filter(function(s){return s[1];}); // Add color tags, format numbers, & add space between labels/numbers for (var i=0; i<numbers.length; i++){ numbers[i][0] = '<color name="'+ redPMS +'">' + numbers[i][0] + '</color>'; numbers[i][1] = '<color name="'+ blackPMS +'">' + formatPhone(numbers[i][1]) + '</color>'; numbers[i] = numbers[i].join(" "); } // Join with 5 spaces return numbers.join(" "); //=============================================================== // // DON'T EDIT BELOW THIS LINE // //=============================================================== function formatPhone(num){ var Var1 = num; var formatStyle01 = "$1.$2"; //simple 7 digit phone var formatStyle02 = "$1.$2.$3"; //simple 10 digit phone var formatStyle03 = "+$1 $2.$3.$4"; //10 digit phone starts with 1 var formatStyle04 = "$1.$2.$3 ext.$4"; //10 digit phone with extension var formatStyle05 = "+$1 $2.$3.$4 ext.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1.$2 ext.$3"; //7 digit phone with extension var thisNumber = Var1; return formatNumber(Trim(thisNumber)); function formatNumber(number01){ 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(number01.match(pattern01)){ number01 = number01.replace(pattern01, formatStyle01); return number01; } else if(number01.match(pattern02)){ number01 = number01.replace(pattern02, formatStyle02); return number01; } else if(number01.match(pattern03)){ if (number01.match(patternStart1)){ number01 = number01.replace(pattern03, formatStyle03); return number01; } else { return number01; } } else if(number01.match(pattern04)){ number01 = number01.replace(pattern04, formatStyle04); return number01; } else if(number01.match(pattern05)){ number01 = number01.replace(pattern05, formatStyle05); return number01; } else if(number01.match(pattern06)){ number01 = number01.replace(pattern06, formatStyle06); return number01; } else { return number01; } } }
  19. Jimmy, check out this thread. It details how to import your rules into a new PDF via the .def file.
  20. Please note I used the Math.ceil property since we are dealing with negative numbers. var was = Int(Field("was price")); // 119.99 var now = Int(Field("now price")); // 69.99 var reduction = Math.ceil(((now - was) / was)*100) + "%"; return reduction;
  21. Oh I see, well let me preface this by saying: I have no experience with MarcomCentral and I'm not sure how "product count" is determined in MarcomCentral. Does it also have to be the total number of records or can it be modified? Anyway, with that caveat in mind, you could link to your input data file as an external data file, and run through it to push the values into a sorted array and reference your data from that. Keep in mind I have no way of testing this, but I would think you could potentially trick FP (using the IsPreview function) into thinking it has the correct "product count" by setting an end record number to the value of the array length (during preview only). You'd want to ignore that block of code if it's not in preview though so that it tests all records. Maybe this can get you started (OnJobStart): if (IsPreview()){ var data = new ExternalDataFileEx(FusionPro.Composition.inputFileName,',') // assuming comma delimited var records = data.recordCount; var composeThese = []; // Add record numbers to an array of files to compose for (var i=1; i<=records; i++){ var postcenter = data.GetFieldValue(i, "Postcenter"); var postnr = data.GetFieldValue(i, "Postnr"); if (postcenter == "KHC") { if (postnr >= 0 && postnr <= 4999) { composeThese.push(i); } } else if (postcenter == "FAC") { if ((postnr >= 5000 && postnr <= 7999) || (postnr >= 8700 && postnr <= 8799)) { composeThese.push(i); } } else if (postcenter == "ARC") { if ((postnr >= 8000 && postnr <= 8699) || (postnr >= 8800 && postnr <= 9999)) { composeThese.push(i); } } } FusionPro.Composition.endRecordNumber = composeThese.length; }
  22. If preview is the only thing you are concerned about, you could just put your existing code within an if statement with a condition checking for whether or not the code is being executed in preview. Like so: if (!IsPreview()){ //Skip records based on postcenter FusionPro.Composition.composeThisRecord = false; if (Field("Postcenter") == "KHC") { if (Field("Postnr") >= 0 && Field("Postnr") <= 4999) { FusionPro.Composition.composeThisRecord = true; } else { FusionPro.Composition.composeThisRecord = false; } } else if (Field("Postcenter") == "FAC") { if ((Field("Postnr") >= 5000 && Field("Postnr") <= 7999) || (Field("Postnr") >= 8700 && Field("Postnr") <= 8799)) { FusionPro.Composition.composeThisRecord = true; } else { FusionPro.Composition.composeThisRecord = false; } } else if (Field("Postcenter") == "ARC") { if ((Field("Postnr") >= 8000 && Field("Postnr") <= 8699) || (Field("Postnr") >= 8800 && Field("Postnr") <= 9999)) { FusionPro.Composition.composeThisRecord = true; } else { FusionPro.Composition.composeThisRecord = false; } } }
  23. Is that the error you get at validation? Does it preview/compose correctly? You could add a try/catch statement when defining your variables so that if the match function can't find any breaks, it will default to being defined as 0. try {var breaks = Rule("Title Copyfit Rule").match(/\<br\>/g).length;} catch(e){var breaks = 0;} var result = ""; if (breaks == 4) result = "<br>"; return result;
×
×
  • Create New...