View Single Post
Old February 4th, 2016, 04:28 PM
step's Avatar
step step is offline
Senior Contributor
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: Composing Several Non-Sequential Records

Originally Posted by JPalchak View Post
A body page does not have master page assigned.
A blank page is emitted since no record is composed properly.

dlpdfdocwritepdf, progress "Doc->PageCount is zero", error: Bad parameter.

PDF Library Document Write Error: Bad parameter.

pdf_om_WriteDoc, dtl_pdf_WritePdf returned "-2"

Job aborted with error.
Is this just because I don't have a blank "null" page set-up if there isn't a record for a body?
This means that FP tried to output a record with no body pages turned on. You'd have to post the actual code that you're using in your OnRecordStart rule for me to tell you how to fix it. The code that I wrote simply tells FusionPro to compose a record or not to compose a record; it does not handle turning turning on/off body pages. But I imagine if you added the following line to turn on at least the first page, the error would go away:
FusionPro.Composition.SetBodyPageUsage(1, true);
By the way, after reviewing the code that I posted earlier, I noticed a problem with the regular expression that triggered the records composition. You should make the below alterations for more reliable results (I also commented what is happening in the code for better grasp of the concept):
var records = [1, 8,'4-6'];         // Records to compose

// Turn the array into a Regular Expression
records = records.filter(String).map(function(s){ 
        s = Str(s);                 // convert the value to a string
        var [a,b] = s.split('-');   // Split the string into an array if there is a dash 
        a = Int(a);                 // Set lower range limit (a) to an integer
        b = Int(b || a);            // Set upper range limit (b) to an integer (b == a if b is null)
        s = [a];                    // Array to hold all values for a range
        while (a < b)               // Until we reach the upper range limit (b),
            s.push(++a);            // increment 'a' and push it into the array of values (s)
        return s.join('|');         // Convert the array back to a string, delimited by a pipe (|)
    }).join('|');                   // Convert the entire 'records' array into a string delimited by a pipe (|)

// Determine if we should compose this record
FusionPro.Composition.composeThisRecord = new RegExp('^(' + records + ')$', '').test(FusionPro.Composition.inputRecordNumber);

FusionPro.Composition.SetBodyPageUsage(1, true); // Turn on page 1

    The above example output:
    records = '1|8|4|5|6'

    The Regular Expression used will be:

    Testing the input number against the above Regular Expression
    will return 'true' if it's one of the numbers in the regex and
    'false' if it's not. Therefore, the 'composeThisProperty' will 
    in turn reflect the presence of a given record in 'records'. 
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

Reply With Quote