JorgeP Posted September 22, 2014 Share Posted September 22, 2014 I want to compose all the single page records to one print file, all the two page records to another print file and all the three page records to yet another print file. Can this be done simultaneously? appending to each output stream as I go Currently I am bringing in multipage pdf's and checking the number of pages and skipping the record if it doesn't match up to a variable I have set but that means I have to compose the same data file three times to make sure I have covered all the possibilities for this job. Other option, can I set a varpages =1 to look for single pages, proceed through data file and create first print file, then increment varpages at last record run the process again without having to do it manually..? Thanks for your help Quote Link to comment Share on other sites More sharing options...
David Miller Posted September 24, 2014 Share Posted September 24, 2014 (edited) ...Can this be done simultaneously? appending to each output stream as I go... I don't think you can actually "append to each output stream". But, I suggest looking at Dan's post here. Not sure if I understand your question in it's entirety. Edited September 24, 2014 by David Miller Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 24, 2014 Share Posted September 24, 2014 (edited) Yes, you can use "dynamic chunking," as described here, among other places. However, this requires that the input data file is sorted into groups of records corresponding to the separate output files. If your input file is not sorted in this way, then you can still open up a new output file whenever you want, but you can only have one output file open at a time. We have been considering an option to "auto sort" the data file, so that the necessary sorting can be done in memory by FusionPro with a pre-processing step, so that you can achieve this kind of "grouping" of input data records into separate output files without having to pre-sort the input file. (We could also do this for external data files, to make lookups faster.) The other wrinkle with your specific requirement is that you're not chunking/grouping records by a data field, but by the number of pages in a PDF resource. What you mention in your post could work, where you would hard-code a particular number of pages to look for, then in OnRecordStart, you can see whether the actual number of pages in the resource associated with that record matches that value, then skip any records that don't match that number of pages by setting FusionPro.Composition.composeThisRecord = false. But you would need to run multiple compositions, changing that number of pages variable each time, to get all of your output. The other thing I can think of, which is more complicated to code in JavaScript, but would allow you to output all of the records from a single composition run, would be to read in the data file as an ExternalDataFileEx in OnJobStart, and then set your main input source to None and set the records to compose from 1 to say, 5, or whatever the highest possible number of pages is. Then, in OnRecordStart, you would iterate through all of the records in the (now "external") data file, find all the ones which match FusionPro.Composition.inputRecordNumber, add them to an Array, then set FusionPro.Composition.inputRecordNumber to the number or records in the Array, then use the FusionPro.Composition.inputRecordNumber property to access each one. It's definitely possible to do this, but it is complicated. If you want to try it yourself, I could help a bit, but the amount of custom JavaScript coding is beyond what I can just do for you in the context of this forum. So you may want to contact our Sales team to inquire about custom (paid) template-building. Edited September 24, 2014 by Dan Korn changed link to absolute URL Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 24, 2014 Share Posted September 24, 2014 Another option may be to output each record to its own file, but to have the files grouped into folders, with logic similar to my post here: http://forums.pti.com/showthread.php?p=15494#post15494 Where you could set the folder name based on the number of pages. Quote Link to comment Share on other sites More sharing options...
David Miller Posted September 24, 2014 Share Posted September 24, 2014 (edited) Yes, you can use "dynamic chunking," as described here, among other places. The link above is not working. I think the post can be found here. Edited September 25, 2014 by David Miller Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 24, 2014 Share Posted September 24, 2014 The link above is not working. I think it the post can be found here. Thanks for catching that. Those relative URL links used to work, but something seems to have changed here that breaks them. I'll look into that further, but I edited my post above to use an absolute URL. Quote Link to comment Share on other sites More sharing options...
JorgeP Posted October 6, 2014 Author Share Posted October 6, 2014 I think the external data file option would work, I will give it a shot. Thanks, Jorge 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.