Jump to content

multiple open output streams


JorgeP

Recommended Posts

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

Link to comment
Share on other sites

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 by Dan Korn
changed link to absolute URL
Link to comment
Share on other sites

  • 2 weeks later...

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