Jump to content

Place graphics sequentially without data


Recommended Posts

I am not sure how to do this. I have a folder with 300 randomly named images (customer-generated QR codes). I need to place each one consecutively onto preprinted stock. I did something like this a long time ago but I thought I had linked to data that had all the paths in a field, so that was easy. Unfortunately, all I have is the images.


Is there a rule that would say "Place the first image in this folder and then place the next image in this folder" and so on?


It seems simple, but I haven't had the need to write JavaScript rule, I mainly do easy switch rules. Any help would be greatly appreciated.



Link to comment
Share on other sites

There's no mechanism currently in the JavaScript subsystem in FusionPro to let you examine or iterate the contents of folders. Such functionality would be a potential security risk on web-to-print systems such as MarcomCentral and DSF.


This is actually something more suited for an FP Server (Producer API) workflow than a Creator/Desktop workflow. FP Server allows you to leverage the composition engine as part of a larger application, which can be automated. For instance, you could have a simple program written in something like C# or Python, or even a DOS batch file, which could iterate the contents of a folder, build up a data file, and then invoke FP Server.


In a Desktop workflow, you would need to do this manually. For instance, you could open up a Command Prompt, CD to your folder, and issue a command such as "dir /B > files.txt", to dump out the list of files in that folder to a data file, which you could then use as the data for your FusionPro composition.


The other option is to write a DLL in C/C++, against a very specific API, and place it into the plug-ins folder for FusionPro. The DLL can expose whatever extended functionality you need to the JavaScript subsystem in FusionPro. This would require some paid consulting assistance, however.

Link to comment
Share on other sites

To my knowledge, that is not functionality that FP has. And while I'm not entirely sure what you mean by "place the first image in this folder and then place the next image in this folder," I think your best bet would be to create a data file that has your graphics in it.


You declare specific paths programmatically for different files but I don't really see how you could do that without a data file.


Are you saying all of your images are in different folders? If they all have a common folder, making a data file can be done pretty simply using bash scripting. Can you be more specific about where the files are located/named/etc? Are they PDFs? EPS's?

Link to comment
Share on other sites

Okay well open up Terminal (Applications/Utilities/Terminal.app) and we can create the data file:

1. copy the following code into Terminal and press enter

echo graphic > ~/Desktop/data.csv

That will create a file on your desktop called "data.csv" with the field name "graphic"

2. type "cd " (with a space) and drag-and-drop the folder containing your graphics onto the terminal window and press enter

3. Copy this code into Terminal and press enter

ls | grep png >> ~/Desktop/data.csv


Now you can link up to that data file that was created on your desktop and pull in your graphics by referencing the "graphic" field. Then you can impose them 3-up using FPImposer.

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...