JeremyT Posted December 17, 2013 Author Share Posted December 17, 2013 My apologies for not giving enough information. I am using Acrobat Pro 10.1.4 with FusionPro 8.2.7 on Mac OS X 10.7.5 I've attached a zip with the complete job. Thank you for your help!Form ABCDEF.zip Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted December 18, 2013 Share Posted December 18, 2013 Get rid of the OnJobStart and OnNewOutputFile rules; everything you need is in OnRecordStart. I'm pretty sure that will give you the results you want. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted December 18, 2013 Share Posted December 18, 2013 Actually, I've kind of lost track of the requirements here, but in addition to getting rid of the other rules, I think you want to change the logic in OnRecordStart (after all the calls to FusionPro.Composition.SetBodyPageUsage) to this: if (FusionPro.Composition.processedRecordNumber == 1 || (FieldChanged("Form Type") && Field("Form Type")=="Form F")) { var outputName = GetFileName(FusionPro.Composition.inputFileName).replace(/^[^1-9]*([^\.]*)20(\d{2})\.\w+$/,Field("Form Type")+'-$1$2.'); FusionPro.Composition.OpenNewOutputFile(outputName + FusionPro.Composition.outputFormatExtension); Print("Changing to output file: " + outputName + FusionPro.Composition.outputFormatExtension); } When I run with this rule, I get one output file named "Form A-548120513.pdf" with the A-E records, and another named "Form F-548120513.pdf" with the Form F records. Quote Link to comment Share on other sites More sharing options...
JeremyT Posted December 18, 2013 Author Share Posted December 18, 2013 Dan, Using the code you just provided splits the final pdfs the way I need them. Is there a way to get the pdf with Forms A-E labeled "Combined-" and then date characters from the data file? The pdf for Forms F is labeled correctly. Thanks, Jeremy Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted December 18, 2013 Share Posted December 18, 2013 Is there a way to get the pdf with Forms A-E labeled "Combined-" and then date characters from the data file? Sure: if (FusionPro.Composition.processedRecordNumber == 1 || (FieldChanged("Form Type") && Field("Form Type")=="Form F")) { var outputPrefix = Field("Form Type")=="Form F" ? "Form F" : "Combined"; var outputName = GetFileName(FusionPro.Composition.inputFileName).replace(/^[^1-9]*([^\.]*)20(\d{2})\.\w+$/,outputPrefix+'-$1$2.'); FusionPro.Composition.OpenNewOutputFile(outputName + FusionPro.Composition.outputFormatExtension); Print("Changing to output file: " + outputName + FusionPro.Composition.outputFormatExtension); }Or, you can change the entire rule to something like this: for (var form = 'A'; form <= 'E'; form = Chr(Asc(form) + 1)) { var formName = "Form " + form; var isCurrentForm = Field("Form Type") == formName; FusionPro.Composition.SetBodyPageUsage(formName, isCurrentForm); } var isFormF = Field("Form Type") == "Form F"; FusionPro.Composition.SetBodyPageUsage("Form F Front", isFormF) FusionPro.Composition.SetBodyPageUsage("Form F Back", isFormF) if (FusionPro.Composition.processedRecordNumber == 1 || (FieldChanged("Form Type") && isFormF)) { var outputPrefix = isFormF ? "Form F" : "Combined"; var outputName = GetFileName(FusionPro.Composition.inputFileName).replace(/^[^1-9]*([^\.]*)20(\d{2})\.\w+$/,outputPrefix+'-$1$2.'); FusionPro.Composition.OpenNewOutputFile(outputName + FusionPro.Composition.outputFormatExtension); Print("Changing to output file: " + outputName + FusionPro.Composition.outputFormatExtension); } Quote Link to comment Share on other sites More sharing options...
step Posted December 18, 2013 Share Posted December 18, 2013 Dan, does that work if there is an imposition applied to the job? It seems like every time I try that code with an imposition applied, the first record is output with the naming convention given in the composition window as discussed here. It's odd because it works correctly if you specify a range of records that is less than the number of records actually in the data file. I thought that preprocessing happened automatically when an imposition file was used. Does preprocessing happen differently when a range of records is specified versus when an imposition is being used? The only work-around to this (that I've seen) is putting the naming convention in an OnNewOutputFile Rule and then calling OnNewOutputFile from OnJobStart to force the naming. Quote Link to comment Share on other sites More sharing options...
JeremyT Posted January 15, 2014 Author Share Posted January 15, 2014 Sure: if (FusionPro.Composition.processedRecordNumber == 1 || (FieldChanged("Form Type") && Field("Form Type")=="Form F")) { var outputPrefix = Field("Form Type")=="Form F" ? "Form F" : "Combined"; var outputName = GetFileName(FusionPro.Composition.inputFileName).replace(/^[^1-9]*([^\.]*)20(\d{2})\.\w+$/,outputPrefix+'-$1$2.'); FusionPro.Composition.OpenNewOutputFile(outputName + FusionPro.Composition.outputFormatExtension); Print("Changing to output file: " + outputName + FusionPro.Composition.outputFormatExtension); } Dan, I used the code you suggested above. Everything works great!!! Is it possible to put the 2 pdfs output into 3 different locations? Thanks, Jeremy Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 15, 2014 Share Posted January 15, 2014 Is it possible to put the 2 pdfs output into 3 different locations? Sure, just include the full path in the call to FusionPro.Composition.OpenNewOutputFile, something like this: if (FusionPro.Composition.processedRecordNumber == 1 || (FieldChanged("Form Type") && Field("Form Type")=="Form F")) { var outputPrefix = Field("Form Type")=="Form F" ? "Form F" : "Combined"; var outputName = GetFileName(FusionPro.Composition.inputFileName).replace(/^[^1-9]*([^\.]*)20(\d{2})\.\w+$/,outputPrefix+'-$1$2.'); var outputPath = "/some path here/folder/etc/"; // or base this on a field value, or whatever FusionPro.Composition.OpenNewOutputFile(outputPath + outputName + FusionPro.Composition.outputFormatExtension); Print("Changing to output file: " + outputName + FusionPro.Composition.outputFormatExtension); }Please note that, with currently released versions of FusionPro, the specified path must already exist. (In the upcoming 9.2 release, the folders will be created as necessary.) Quote Link to comment Share on other sites More sharing options...
JeremyT Posted January 16, 2014 Author Share Posted January 16, 2014 if (FusionPro.Composition.processedRecordNumber == 1 || (FieldChanged("Form Type") && Field("Form Type")=="Form F")) { var outputPrefix = Field("Form Type")=="Form F" ? "Form F" : "Combined"; var outputName = GetFileName(FusionPro.Composition.inputFileName).replace(/^[^1-9]*([^\.]*)20(\d{2})\.\w+$/,outputPrefix+'-$1$2.'); var outputPath = "/some path here/folder/etc/"; // or base this on a field value, or whatever FusionPro.Composition.OpenNewOutputFile(outputPath + outputName + FusionPro.Composition.outputFormatExtension); Print("Changing to output file: " + outputName + FusionPro.Composition.outputFormatExtension); } Adding the variable outputPath to FusionPro.Composition.OpenNewOutputFile allowed me to tell the composed PDF where to go. How do I get it to go to 3 folders, each on a separate server? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 16, 2014 Share Posted January 16, 2014 Adding the variable outputPath to FusionPro.Composition.OpenNewOutputFile allowed me to tell the composed PDF where to go. How do I get it to go to 3 folders, each on a separate server? Okay, wait. Do you mean that you want each output file to go to its own folder, or do you mean that you want each output file to be copied to three different folders? If you want each output file to go to its own folder, then just program it to do that, something like this: var outputPath = Field("Form Type")=="Form F" ? "/Volumes/server1_name/folder_path/etc/" : "/Volumes/server2_name/folder_path/etc/";Since you're on a Mac, you can't make use of handy UNC paths like on Windows. You have to first mount an external drive from the server, and then OS X assigns it a path under /Volumes. Exactly what the mounted path would be, I can't say; you have to connect to it, then you can do a "Get Info" from the Finder to see the path. If you mean that you want each output file to be copied to three folders, then sorry, but FusionPro VDP Creator doesn't do that. You would either need to write some kind of custom app that watches the output folder, then copies the file to some other folders, or use FusionPro VDP Producer API (FP Server). If you compose via Producer (FP Direct), you can specify a printer hot folder where the output will be copied. Quote Link to comment Share on other sites More sharing options...
JeremyT Posted January 20, 2014 Author Share Posted January 20, 2014 I wanted each output file to be copied to three different folders but it can't be done. Quote Link to comment Share on other sites More sharing options...
JeremyT Posted January 20, 2014 Author Share Posted January 20, 2014 Thank you for all the help! 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.