Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. Andrew, are you photos named "photo 1 Stein Aanensen.jpg"? Or is photo 1 named "Stein Aanensen.jpg"? I think the second of the two options is a better naming convention but I think you could make either work using this code: var path = "/jobs/ron digital stuff/mission reunion/photos/"; var name = Field("YOUR NAME FIELD HERE"); // replace with your name field return CreateResource(path + name + ".jpg"); If you have your image named: "photo # Name.jpg" then it would help that photo 1 corresponded with record one, photo 2 corresponded with record 2, etc. For example: if Stein Aanensen's photo is titled: "photo 1 Stein Aanensen.jpg," then he should be the first record in the data file. If that's the case you could use this code: var path = "/jobs/ron digital stuff/mission reunion/photos/"; var name = Field("YOUR NAME FIELD HERE"); // replace with your name field return CreateResource(path + "photo " + CurrentRecordNumber() + " " + name + ".jpg"); Hope that helps.
  2. I think the comma is throwing off the calculation. Try this: var account = StringToNumber(Field("ACCOUNT-ENDING")[color="Red"].replace(/,/g,"")[/color]) var company = StringToNumber(Field("COMPANY-ENDING")[color="red"].replace(/,/g,"")[/color])
  3. As far as your first question goes: no, not that I'm aware of. In regards to your second question, I would think you'd want to create a global variable for your date that's returned in the EXP_date rule and populated in the OnRecordStart call back.
  4. switch (Field("Address1").toLowerCase()) { case "1".toLowerCase(): return "<br>1720, 633 - 6<superscript>th</superscript> Avenue, SW<br>Calgary, Alberta"; case "2".toLowerCase(): return "530 Canal Street<br>PO Box 2017<br>Brooks, Alberta"; case "3".toLowerCase(): return "<br>Site 1 Comp. 2 RR 1<br>Blackfalds, Alberta"; case "4".toLowerCase(): return "<br>3335 - 33<superscript>rd</superscript> Street<br>Whitecourt, Alberta"; case "5".toLowerCase(): return "<br>9011 - 154<superscript>th</superscript> Avenue<br>Grande Prairie, Alberta"; Make sure you have "return strings as tagged text" checked.
  5. I'd bet you have this set to downsample to 72dpi at composition. When you compose, click the "Graphics" tab, and verify that under "downsample all graphics to 72 dpi" the first radio button ("Never, graphics are used at their full resolution") is selected.
  6. I've never tried this (and even as I'm typing this I still haven't tried my solution to see if it works – so I'm sorry if it doesn't!) That being said, my guess would be that you'd just define a second data file like so: //Link to the 2nd external data file. //The '\t' is used to indicate TAB delimited data in this external data file SecExternalDF = new ExternalDataFileEx('test2.txt', '\t'); if(SecExternalDF.valid != true) { Print('Failed to link to the second external data file in OnJobStart'); }
  7. Interesting. It worked for me. Maybe this is a difference between FP8.0 and 7.2?
  8. How are you intending on matching the images to each address if there's nothing in the data to drive the variable images? If the images are named sequentially 1-800 (i.e. 1.jpg, 2.jpg, etc) and the image corresponds to the record (i.e. record 1 returns 1.jpg, record 50 returns 50.jpg, etc) then you could do something like this: return CreateResource("/path to graphics/"+ ToString(CurrentRecordNumber()) + ".jpg");
  9. The reason you aren't getting the results you anticipated is because FusionPro wants to collate each page in your PDF document per record. So you get 3 pages per record. Here's a 5 step work around that should give you the results you want: 1. FusionPro > Data Definition > Wizard > click "next" > select "None" and click "Next" > click "Finish" 2. FusionPro > Manage Pages > Page Usage > "Edit" each page, setting them to "unused" and name them 1, 2, and 3 respectively. 3. Create an "OnJobStart" callback rule with the following code: FusionPro.Composition.composeAllRecords = false; FusionPro.Composition.endRecordNumber = 300; 4. Create an empty text rule called "Number" with this code: return FormatNumber("000",CurrentRecordNumber()+99); 5. Create an "OnRecordStart" callback rule that contains the following code: var pg = Left(Rule("Number"),1); FusionPro.Composition.SetBodyPageUsage(pg,true); This solution bypasses your data file and allows you to use only one page per "record" by turning on and off each page. Hope that helps!
  10. I'm assuming you deleted this line of code that defined "Var1" when you added mine: var Var1 = "RecipientFirstName"; I'm sorry – it probably wouldn't have hurt for me to specify ha.
  11. On the "Layout" tab of FPImposer under "Step and Repeat", is the leftmost drop down menu set to "Stack"? The other thing to check would be to make sure the "Infinite Stack" checkbox is selected. If that doesn't work, maybe you could upload you .fpi file for me to look at for you.
  12. return (Field("RecipientFirstName") != "") ? ToTitleCase(Field(Var1)) + "," : "";
  13. Is there any way you could upload a sample of the file you're having an issue with so that I could take a look at it? I want to say the solution could be as simple as opening your imposed PDF and setting your TrimBox to zero in the crop pages menu (for all pages in the document). But I kind of like the gremlin scenario.
  14. I think your best bet may be to input the address block as a Formatted Text Resource so that your type doesn't get rasterized and whatnot. Then you can call the appropriate text resource based on the version type. Is that what you're trying to accomplish or have I completely misunderstood the question? (I do that sometimes haha)
  15. Sure. FindTextFrame("Fact1").content = result[0]; FindTextFrame("Fact2").content = result[1]; Where the text frames are named "Fact1" and "Fact2" respectively. You access the elements within the array with the brackets and define its position. 0 is the first position, 1 is the second, etc. In this case, the array only has two of the positions filled (your two random facts). Similarly, you could create a rule called "Fact1" (for example) and return the first position in the array: return result[0];
  16. Just modify the return code: return result.join("<br>"); And make sure you have "Treat returned strings as tagged text" checked.
  17. Did you copy and paste the entire block of code? "result" is the array that's being returned. It's defined here (line 2):
  18. Hi Brian, If I understand correctly what you're trying to accomplish, I think this code should be able to help you: var facts = ["fact1","fact2","fact3","fact4","fact5","fact6","fact7","fact8"]; // Create an array of facts var result = []; // Create an array to hold the facts at random for (var i=0; i<2; i++){ var number = Math.floor(Math.random()*facts.length); // generate a random number between 0 and length of the array result.push(facts[number]); // push the fact into the result array facts.splice(number,1); // remove that fact from the Facts array so that it won't be pulled again } return result;
  19. I'm not sure that you can adjust the width of the text box based on the length of a field but you can adjust the width of a cell in a table on the fly. I created a table with 1 row and 3 columns. The outside columns are empty and are set at the width of 3pt to give you your 3pt white space on either side of the name. I used TextMeasure to variably adjust the width of the inside column based on the length of the "Name" field. This should be a good starting point for you: // Use TextMeasure to measure the length of each name var tm = new FusionProTextMeasure; tm.pointSize = "10 pt"; // set the type size tm.font = "Helvetica"; // set your typeface tm.CalculateTextExtent(Field("Name")); // Replace with your field tm.useTags = false; var tmWidth = tm.textWidth; // Create table var myTable = new FPTable; myTable.AddColumns(300, tmWidth, 300); myTable.AddRows(1); // Declare TableMargin object to adjust margins myTable.Rows[0].Cells[0].Margins = new FPTableMargins; myTable.Rows[0].Cells[0].Margins.Top = 60; myTable.Rows[0].Cells[0].Margins.Bottom = 60; myTable.Rows[0].Cells[0].Margins.Left = 0; myTable.Rows[0].Cells[0].Margins.Right = 0; myTable.Rows[0].Cells[0].VAlign = "Middle"; myTable.Rows[0].Cells[0].HAlign = "Center"; myTable.Rows[0].Cells[0].Font="Helvetica"; myTable.Rows[0].CopyCells(0, 1,2); myTable.ShadingColor1 = "White"; myTable.ShadingPct1 = 100; myTable.ShadingRepeat1 = 1; myTable.ShadingType = "ByRow"; myTable.Rows[0].Cells[0].Content = ""; myTable.Rows[0].Cells[1].Content = Field("Name"); myTable.Rows[0].Cells[2].Content = ""; return myTable.MakeTags().replace(/^\<table/, "<table alignment=center"); // Center table in Text box
  20. I understand. I only want to use 1 imposition per composition. But I'd like to make a template that would run through some code and figure out (depending on the quantity) which is the best imposition for it to use. We get weekly business card orders and the quantities and versions vary. So I'd like to make 3 impositions (21 up, 24 up, and 20 up) and depending on how many there are, the correct FPI file is applied at composition. For example, last week we had 4 versions of the business card and our press operator would like to have 5 up of each on the press sheet so the 20up imposition would be applied. But this week could have 7 versions, so I'd want to apply a 21 up imposition and repeat each version 3 times with "repeatRecordCount".
  21. Is there a way to potentially have more than one FP Imposition file and call them based on an OnNewOutput rule?
  22. This will format the fields as you have requested, however it won't take into account scenarios where the "city" field is blank and leaving you with something that looks like this: ", TN 55555". return ToTitleCase(Field("City")) + ", " + ToUpper(Field("State")) + Field("Zip"); To address that issue try the following: return (Field("City") != "") ? ToTitleCase(Field("City")) + ", " + ToUpper(Field("State")) + Field("Zip") : Field("Zip"); With the above code, it will only return the zip code if the city field is blank.
×
×
  • Create New...