DavisDirectPrepress Posted July 22, 2014 Share Posted July 22, 2014 I have a job that is calling in several different images that are being identified in the data. The problem is that some of those images need to have variable data printed on them in a specific place that is also coming in from the same data file. And there is no indication when a static image and a variable image will be pulled in (the job has almost 20000 records). Is there a way to make the variable images into stand-alone objects, each populated by the necessary data, which are then called in variably by a graphic switch into the main body of the letter as needed? This is what I have so far... (Graphic Rule) switch (Field("IMAGE1").toLowerCase()) { case "100C".toLowerCase(): return Resource("100C.pdf"); case "155C".toLowerCase(): return Resource("154C.pdf"); case "LN02".toLowerCase(): return Rule("LN02_Chart1"); case "CD01".toLowerCase(): return Rule("INCDBS_Chart1"); default: return NullResource() } LN02_Chart1 (Text Rule) var returnString = ""; var catalogItem = new FPRepeatableComponent("LN02_table"); catalogItem.AddTextVar("OldNum", Field("OLDACCT1")); catalogItem.AddTextVar("NewNum", Field("NEWACCT1")); returnString += catalogItem; var catalogItem = new FPRepeatableComponent("LN02_table"); catalogItem.AddTextVar("OldNum", Field("OLDACCT1")); catalogItem.AddTextVar("NewNum", Field("NEWACCT1")); returnString += catalogItem; return returnString; LN02_table is a template page set up with those variables defined. I'm wanting to make sure my logic is sound. I know that I can only return graphic resources with graphic rules, which will be the next issue to tackle (any ideas on that one?), but for now I just want to make sure I'm on the right path with how I'm going about this. The first rule is being returned (through another text rule) inside of a text frame. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 23, 2014 Share Posted July 23, 2014 There's a lot to sort through here, and I'm not sure I'm understanding all of it without having the job to look at. A picture, or even an uploaded sample template, may be worth a thousand words. But I'll try to answer your questions as well as I can. I have a job that is calling in several different images that are being identified in the data. The problem is that some of those images need to have variable data printed on them in a specific place that is also coming in from the same data file. And there is no indication when a static image and a variable image will be pulled in (the job has almost 20000 records). Is there a way to make the variable images into stand-alone objects, each populated by the necessary data, which are then called in variably by a graphic switch into the main body of the letter as needed? Do you mean inline graphics, that flow with the text? If so, you just make a text rule that returns either a Graphic resource or a <graphic> tag, and call it out in text just like any other text rule. Or do you mean that the data defines a specific X,Y position for the graphic on the page? If so, then you can use the FindGraphicFrame function and set the .x and .y properties on the returned object to move frames at composition time. However, this requires a FusionPro Producer (Direct) or Producer API (Server) license, or composing to a web-to-print system such as MarcomCentral. Another option, which will work regardless of your license, is to use tables. You can set tweak column and row sizes to effectively move the contents of a table cell (where the cell contents can be either text or inline graphics, or a combination thereof). Also, I'm not sure what you mean by, "there is no indication when a static image and a variable image will be pulled in." If there's no indication in the data, then I'm not sure what to divine in a rule. Also, there are no "static" graphics in a FusionPro job, other than the static background from your template PDF (and that's completely optional; you can use a blank PDF as a template and just put variable graphics and text down). LN02_Chart1 (Text Rule) var returnString = ""; var catalogItem = new FPRepeatableComponent("LN02_table"); catalogItem.AddTextVar("OldNum", Field("OLDACCT1")); catalogItem.AddTextVar("NewNum", Field("NEWACCT1")); returnString += catalogItem; var catalogItem = new FPRepeatableComponent("LN02_table"); catalogItem.AddTextVar("OldNum", Field("OLDACCT1")); catalogItem.AddTextVar("NewNum", Field("NEWACCT1")); returnString += catalogItem; return returnString; LN02_table is a template page set up with those variables defined. I'm wanting to make sure my logic is sound. I know that I can only return graphic resources with graphic rules, which will be the next issue to tackle (any ideas on that one?), but for now I just want to make sure I'm on the right path with how I'm going about this. The first rule is being returned (through another text rule) inside of a text frame. FPRepeatableComponent objects should be returned from text rules, not from graphic rules. The repeatable component then gets treated kind of like its own line in the text flow, similar to an inline graphic. Generally, this is done in conjunction with an Overflow page, so that you can have an arbitrary number of repeatable components flowing to multiple pages, like in a catalog-type job (from an example of which you presumably cribbed the code using a variable named "catalogItem"). If you might have either just a graphic by itself, or a repeatable component, for different records, then just put down both a text frame and a graphic frame, right on top of each other, and then populate just the one you need. Quote Link to comment Share on other sites More sharing options...
DavisDirectPrepress Posted July 23, 2014 Author Share Posted July 23, 2014 Thank you for your help and response, Dan! The data has twenty fields in it, which correspond to the name of an image and the data that will go inside of it if it calls for it. For example, we have IMAGE1 field and ACCOUNT1 field. IMAGE1 has the name of the pdf file that's been loaded into the FusionPro job, and ACCOUNT1 has the number that will print in the box inside of the graphic. Only certain images get the Account information printed inside of it, the majority will just call in the graphic and be done with it (hence why I called them static images). The problem is that the images that are getting a second variable are scattered throughout the data for the same record, and the images have to flow one right after the other without interruption, so we need a way to seamlessly integrate both 'kinds' of images. For example, IMAGE1 has a graphic that just prints, so I call that in; IMAGE2 has a graphic that needs to print ACCOUNT2 on it, and then IMAGE3 will have a graphic that just prints. I have a text frame on the page that is pulling in every possible graphic for every field (the first switch I posted) one right after another. That switch is only for IMAGE1 fields; I have multiple switches, one for each field. Your suggestion about the FindGraphicFrame is a good one and one I'd love to use, but we don't have those licenses, and the possibility of us getting them is very low. I thought that the FPRepeatableComponent was the best solution to my problem, but as you observed, I can't get a return of a text string in a graphic rule. Is there a way for me to get around that? Any help is appreciated. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 23, 2014 Share Posted July 23, 2014 Well, I'm still not quite seeing the whole thing in my head without something a bit more concrete. But I think you might be able to just use multiple, overlapping text and graphic frames. For example: If you have, for example, a graphic frame and a text frame on top of it, then you have a text rule and a graphic rule which each of those call out. So: For example, IMAGE1 has a graphic that just prints, so I call that in; The graphic rule returns the graphic, and the text rule returns nothing (return ""). IMAGE2 has a graphic that needs to print ACCOUNT2 on it The graphic rule returns the graphic, and the text rule returns ACCOUNT2.and then IMAGE3 will have a graphic that just prints. The graphic rule returns the graphic, and the text rule returns nothing (return ""). Quote Link to comment Share on other sites More sharing options...
DavisDirectPrepress Posted July 24, 2014 Author Share Posted July 24, 2014 That's exactly what I was thinking, Dan. I was trying to set it up that way, but the images need to flow together one right after another. I think I've found a workaround but I'll need some time to test it out. Thank you for your help, you've put me on track to several ideas for other issues I was having. 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.