Jump to content

To Compose or Not to Compose...


TDennis

Recommended Posts

Hello,

Using the built in rule for insertPicture, I have a project that is matching two pdf resources based on data in two fields and creating individual 2 page composed output files with a default pdf if no match is found. In other words each record gets a 2 page matching output pdf based on 2 fields in the record. Also, in onRecordStart I have an if statement that appends the output file name as either a match or no match for easy identification.

 

All works very well.

 

The dilemma is that the "matching" files are continuously being updated as they come to us. So unmatched files may become "matched" when new files come and the job is recomposed. What I would like to do is the following:

1) Set FP to compose to two different directories depending on whether they are matched or not.

2) Skip composing the matched file if it already exists (from a previous compose) instead of overwriting it.

3) Delete a "no match" file if a match now exists and then of course compose the record as a matched file.

 

I’m playing around now with outputFileFullPathName to see about #1 above. And I've tried setting the matched file's name into a variable (fileName) and use - fileName.exists to then either compose or not compose (#2 above), but no luck. And I'm unsure if the deletion part is even possible with a FP javascript?

 

Thanks all ahead of time for your help.

 

Tyler Dennis

Spring Hill Laser Services

FP ver. 7.2, Win7Pro, Acrobat 9

Edited by TDennis
Link to comment
Share on other sites

You're correct that FusionPro VDP Creator (Desktop) does not do that kind of file management. What you're really trying to do is develop an automated process where a job is automatically composed when a file appears. That's exactly the kind of thing that FusionPro Server was designed to do.
Link to comment
Share on other sites

Dan,

 

Thanks for your prompt reply. It would be nice if it were automated, but unfortunately we don't know when the matching files are going to arrive as they come from the USPS and are downloaded manually. So the actual composure has to also be done manually. I just want to automate some of the process of whether or not a record should be composed and what folder it should be composed to.

 

Tyler

Link to comment
Share on other sites

Thanks for your prompt reply. It would be nice if it were automated, but unfortunately we don't know when the matching files are going to arrive as they come from the USPS and are downloaded manually. So the actual composure has to also be done manually.

Well, there are different levels of manual and automated. With FP Server, you could set up a hot folder, so that all a human would need to do is drop the new file into a folder after downloading it, which would then invoke a composition, without performing all the manual steps in Creator (i.e. open Acrobat, open the FusionPro template, point to the new data file, click Compose, etc., plus Acrobat is tied up while the composition is happening). Or you could write your own application logic and use the FusionPro Server API to invoke a composition with full control over all of the composition parameters. Eventually, you could probably automate such a workflow even further, so that the files automatically get pulled from the USPS, say at regular intervals, and then composed.

I just want to automate some of the process of whether or not a record should be composed and what folder it should be composed to.

I get it. And as you have found out, you can do most of that in Creator. But it can't do some of the things you want, such as knowing whether to overwrite or delete a file.

Link to comment
Share on other sites

Hey I got all of it except the deletion part!

 

Firstly I set up a variable for the outputFileFullPathName in onRecordStart that sets the file & path to compose for matched or unmatched. Then I did an "if exists" on the same variable to see if the file has already been written and set a true or false to compose. I guess the deletion of the unmatched records will have to be done manually... no biggie.

 

Thanks for your replies and yes in the long run we might look at Server, but in the near future we are looking forward to upgrading to Creator 10.

 

Thanks again,

 

Tyler

Link to comment
Share on other sites

Well I spoke too soon. While I do have the correct file path for matched or unmatched working with the variable "outputPathName", the following code I thought would handle whether or not to compose if the file output file has already been composed. But it doesn't work. Any suggestions?

 

- In onNewOutputFile I have:

if (outputPathName.exists)

{

FusionPro.Composition.composeThisRecord = false;

}

else

if (!FusionPro.Composition.isPreview)

{

FusionPro.Composition.outputFileFullPathName = outputPathName;

}

}

 

Tyler

Link to comment
Share on other sites

Well I spoke too soon. While I do have the correct file path for matched or unmatched working with the variable "outputPathName", the following code I thought would handle whether or not to compose if the file output file has already been composed. But it doesn't work. Any suggestions?

First, the code that determines whether to compose the record has to go into OnRecordStart, not OnNewOutputFile. Also, I'm not sure where the variable "outputPathName" that represent the file whose existence you're determining is set. But I think you want to do basically this:

// OnRecordStart
FusionPro.Composition.composeThisRecord = !CreateResource(outputPathName, "graphic").exists;

The code that sets the output path does go in OnNewOutputFile, but you shouldn't need any condition there:

FusionPro.Composition.outputFileFullPathName = outputPathName;

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.

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