Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. Try replacing "CurrentRecordNumber()" with "FusionPro.Composition.inputRecordNumber" Edit your fpi file so that the pages per record is "1" not "4".
  2. Have you looked at this thread
  3. You can't telescope (or cut-and-stack) a FusionPro document that contains 4 pages. It will always collate those pages. You need to set up a 1 page FusionPro template that will pull in each page of that PDF however many times (should be the quantity of each card). I haven't tested the code below myself but I think you'll want to do something like this: OnJobStart: FusionPro.Composition.composeAllRecords = false; FusionPro.Composition.endRecordNumber = 4; // Number of cards you have OnRecordStart: FusionPro.Composition.repeatRecordCount = 500; // Quantity of each card var card = CreateResource("path/to/resource/YOURPDFNAME.pdf",'graphic',true); card.countpages; card.pagenumber = CurrentRecordNumber(); FindGraphicFrame("YOURGRAPHICFRAMENAME").SetGraphic(card);
  4. Would this work the way you want it to? return TaggedTextFromRaw(Field("maintxt")).replace(/(^(\b.*?)(?:\.|\?\!))/gi,'<color name="CHS-4014">$1</color>');
  5. Eight rows of data as in 8 records (records 1 - 8) on one form? And then the second page is records 9-16? If that's the case, you may want to bring your data file in as an external data file and start an array to bring 8 records in as 1. It might be easier, though, to compose the records imposed 8 up and then bring them into a template page after the fact.
  6. First things first: Create a graphic rule. Go to your rules, select 'new', click the 'graphic' radio button, and select "Empty Rule". Name it something like "Background." Then paste this: return CreateResource("filename.pdf"); Replace "filename.pdf" with the name of the pdf you wish to pull in. Next, draw a graphic frame spanning the entire document and click on it's properties and assign the "Background" rule you just created to that text frame. Finally, move that frame to the back by selecting "FusionPro>Layers>Send Frame to Back". In order to change the background, you'll need to edit the "Background" rule and change out the file it's pulling in. And if the files aren't in the same directory as your template itself, you'll need to add a path in order for FusionPro to find it. This can be done at the composition stage. (Compose>Advanced -- and edit the "Search Path")
  7. Just my hypothesis: It almost looks like the "behind the scene" code is using an array and a for loop to populate those connected frames. The code may see "bond program loans" as the last element in the array and populate each resulting text frame with the last element in order to make it through the loop. My guess is that the 'for' loop needs to be altered so that it stops executing after the length of the array rather than the number of text fields that you have. Alternatively, I suppose you could manually set those text frames to be populated using the TextMeasure and assigning the values to them until the array is empty (suppressing the ones that are unused).
  8. Is there a reason you aren't just creating a 1up template file numbered 1-999 (or whatever) and imposing them 2 up rather than having an abundance of numbering rules that number the pieces in stacks of two? Aside from that, I would think you'd just make the background (your customer specific art) a graphic frame that pulled in your various art. This solution leaves all of your text frames' positions and formatting in tact and only swaps out the background.
  9. Very true though his signature said he was running FP7.2
  10. You probably want to do something like this: JavaScript Globals: var img = ""; OnRecordStart: if (img != Field("Image")){ FusionPro.Composition.SetBodyPageUsage("Slipsheet",true); img = Field("Image"); }
  11. Sounds like you could use a table to line up everything. I don't know what font and what font size you're using so I didn't mess with the column widths too much but I've commented out beside what you'd need to change to get the table to fit your text. This should get you started: var numbers = [Field("Office"),Field("Mobile")]; // Your field names numbers = numbers.filter(String); new FPTable; var myTable = new FPTable; myTable.AddColumns(4800, 2000, 14400); // Column 1, 2, & 3 width respectively. 1in = 7200 myTable.AddRows(numbers.length); for (var i=0; i<numbers.length; i++){ myTable.Rows[i].SetContents(numbers[i].split("+")[0], "+", numbers[i].split("+")[1]); } return myTable.MakeTags();
  12. I realize that I've gotten off topic and I apologize for that. I just started the thread whilst in the middle of debugging the code and what I initially thought was causing the problem (IsResourceLandscape) turned out not to be. I realized that yesterday but thought it would be better to consolidate my posts into this one thread instead of bombarding the forum with every potential culprit for my problem. I do, however, appreciate you taking the time to respond and helping me troubleshoot despite the vague description of the problem!
  13. So after reading your post in this thread, you stated that "the search path for finding graphics isn't completely set up at preprocessing time." If that still remains true, that could be my problem. Since I'm repeating my records based on the number of pages in my PDF resource, it would be impossible for FP to know how many times to repeat a record and calculate infinite stacking if the graphics aren't completely set during the preprocessing. var path = "/Volumes/path/to/"; path = (FusionPro.isMac) ? path : path.replace("Volumes","ServerName").replace(/\//g,"//"); var pdf = CreateResource(path + Field("name"),'graphic',true); [color="Red"]var pages = pdf.countPages; FusionPro.Composition.repeatRecordCount = pages; pdf.pagenumber = FusionPro.Composition.repeatRecordNumber;[/color] // Enables desktop composition /* if(FusionPro.Composition.inPreprocessing) return ; */ function IsResourceLandscape(res) { if (typeof TestedGraphics[res] != "undefined") return TestedGraphics[res]; if (!res instanceof FusionProResource) throw "Not a resource: " + res; if (!res.exists) throw "Resource not found: " + res; var TM = new FusionProTextMeasure; TM.useTags = true; var err=TM.CalculateTextExtent(res.content); if (err) throw "Error measuring resource: " + res + ": " + TM.messages; var result = TM.textWidth > TM.textHeight; TestedGraphics[res] = result; return result; } var orientation = (IsResourceLandscape(pdf)) ? "landscape" : "portrait"; FindGraphicFrame("page_" + orientation).SetGraphic(pdf); I'm able to get the page count supplied to me in the data so once I added that field and removed the .countPages, the job imposed correctly on Producer. Does that sound like a probable cause for my problem?
  14. Dan, in this line of code, I replace "Volumes" with the server name and replace forward slashes with //: path = (FusionPro.isMac) ? path : path.replace("Volumes","ServerName").replace(/\//g,"//"); The hardcoded path (as it's written above) works for composition on a Windows server when there is no imposition applied. Once the imposition is applied, the job errors if I'm not running it locally (via Creator). That being said, I took your advice and removed the path variable from my CreateResource and added both paths as a "search path" in the composition dialog box. And that didn't work either. Is there an issue with using infinite stacked impositions on Producer?
  15. The error message says: For full disclosure: I am attempting to populate my graphic frames in the OnRecordStart call back. By adding this line of code I'm able to get the job to compose and impose as I'd expect (locally): (I'm guessing it works because it causes the code to stop executing before it gets to the IsResourceLandscape function but I'm not sure why I'm not seeing the same results when composing the job server side. But I'm hoping Dan can elaborate more on this object). if(FusionPro.Composition.inPreprocessing) return ; But when I attempt composition on our FP Server (using Producer), the file errors at record 1. I'm pasting my code as it is (with the exception of the path being modified) in hopes that one of you kind-hearted souls can help me out with getting the results I need. Thanks in advance! var path = "/Volumes/path/to/"; path = (FusionPro.isMac) ? path : path.replace("Volumes","ServerName").replace(/\//g,"//"); var pdf = CreateResource(path + Field("name"),'graphic',true); var pages = pdf.countPages; FusionPro.Composition.repeatRecordCount = pages; pdf.pagenumber = FusionPro.Composition.repeatRecordNumber; // Enables desktop composition /* if(FusionPro.Composition.inPreprocessing) return ; */ function IsResourceLandscape(res) { if (typeof TestedGraphics[res] != "undefined") return TestedGraphics[res]; if (!res instanceof FusionProResource) throw "Not a resource: " + res; if (!res.exists) throw "Resource not found: " + res; var TM = new FusionProTextMeasure; TM.useTags = true; var err=TM.CalculateTextExtent(res.content); if (err) throw "Error measuring resource: " + res + ": " + TM.messages; var result = TM.textWidth > TM.textHeight; TestedGraphics[res] = result; return result; } var orientation = (IsResourceLandscape(pdf)) ? "landscape" : "portrait"; FindGraphicFrame("page_" + orientation).SetGraphic(pdf);
  16. Oh, I see. When I'm trying to validate the rule I get an uncaught exception saying that FP has had an "Error measuring the resource." I noticed where the error was being generated in the code but thought it was because the resource wasn't physically linked to the template as a resource. After I composed the file, however, the results were as I expected it to me. In FP8 does TextMeasure not run until composition?
  17. I've read a couple of threads regarding determining the orientation of a resource. Is there a way to do this without physically adding the resource (pdf's in my case) as a FusionProResource? I am setting up a template that will pull in pdfs and output a portrait file. The data that is passed to me consists of the file names so I won't be able to automate the process if I have to physically add them as resources of the template. Am I able to get the width and height of the image using the text measure function if I pass it the path within graphic tags? Is there a different solution that I may have overlooked?
  18. Your syntax is a little mixed up: if (Len(Trim(Field("FIRST NAME"))[color="red"])[/color] >= 2) // You were missing a ')' and had an extra one at the trail end { return [color="red"]Trim[/color]([color="Red"]Field[/color]("FIRST NAME")); // Trim function needs to be around the Field } else { return "Hello"; // You do not need '()' around this string } Of course, if you'd like to condense your code a little, you could replace it with this: return (Len(Trim(Field("FIRST NAME"))) >= 2 ) ? Trim(Field("FIRST NAME")) : "Hello";
  19. I haven't tried this myself, but it sounds like you should be able to accomplish what you're trying to do without having to split each page into its own template: I think you would want to name the pages in your template 1-6, set them all to unused, and then repeat each record 6 times. Then turn on each page based on the RepeatRecordCount. And then change your OnNewOutput rule to incorporate the count into the file name.
  20. This code is conflicting with itself: FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091404-1"); FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091405-1"); If the field "Frontgraphic" is "091404-1" "GCFront" page is turned on, but since it can't also be "091405-1" at the same time, "GCFront" is turned off.
  21. If you're intending for the two pages to back up to each other, you're going to have to do what Eric suggested and duplicate the template page or create a 1-up pdf file and impose outside of FusionPro. I think "duplicating" is just going to duplicate a record down or across the imposition position.
  22. I noticed that this issue was addressed in the release of FP9 but was wondering if there was a fix for this in FP8 that I may have missed.
  23. Yes. Are you asking because you did that and it didn't work? After re-reading the entire thread, I'm not sure why Alex suggested setting the first page to "used". They should all be set to "unused" and turned on via the OnRecordStart rule so that you only end up with 2 pages (front and back) per record.
  24. Try using a switch statement to accomplish this and clean up the code a little bit: switch (Field("card")) { case "snowbasin": FusionPro.Composition.SetBodyPageUsage("snowbasin",true); FusionPro.Composition.SetBodyPageUsage("sunvalley",true); break; case "sunvalley": case "SV. Condominium Op.": FusionPro.Composition.SetBodyPageUsage("sunvalley",true); FusionPro.Composition.SetBodyPageUsage("back",true); break; case "Retail": FusionPro.Composition.SetBodyPageUsage("Retail",true); FusionPro.Composition.SetBodyPageUsage("retailback",true); break; case "Recreation": FusionPro.Composition.SetBodyPageUsage("sunvalley",true); FusionPro.Composition.SetBodyPageUsage("recback",true); break; }
  25. Try replacing the "\n" with "<br>"
×
×
  • Create New...