Jump to content

Set FP Expression Image in Loop


Recommended Posts

I have the following snippet of code in a loop in OnRecordStart where I am trying to populate many sequentially named graphic frames with FusionPro Expression images.


The problem I am running into is the .SetGraphic parameter must be a resource type "graphic". How would I set an "FP Expression Image" resource so I can do this in the loop?


var myPI = CreateResource(fpx_array[x], "FP Expression Image");

   FindGraphicFrame("fpx-" + x).SetGraphic(myPI);

Link to comment
Share on other sites

That validates which is a nice step forward but it errors in the composition log.


Composing record #1, input record 1

Graphic is not found or is not processed properly: <pimage file=ArtGallery_85009_24fpx.fpx><data>Thomas</data></pimage>.

Check for file existence and that it is of the proper format.

No value associated to graphic copyhole <> in record 1.


The "ArtGallery_85009_24fpx.fpx" file, along with the others, is in the same directory as the template file. I also tried bringing the files into FusionPro's Resources. In the error log it lists the entire path when I do that, so I'm sure it's finding the files okay. It must be the "of the proper format" part it's having an issue with.

Link to comment
Share on other sites

Ah, okay, sorry.


I don't think there's a way to do that, at least not directly. The FusionProGraphicFrame.SetGraphic and FusionPro.Composition.AddGraphicVariable functions really do take only "regular" graphics, not personalized images.


How many FP Expression images are you trying to use in a record? I haven't seen a many jobs with more than two or three. You might be able to rework the job to use Imposition instead.


Or, you could bring in the images as inline graphics in text frames, like so:

FindTextFrame("fpx-" + x).content = myPI.content;

You can also set the width and/or height, just like with any other inline graphics; something like this:

FindTextFrame("fpx-" + x).content = ReplaceSubstring(myPI.content, "<pimage ", "<pimage height=7200 ");

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...