You can use this to determine the number of break tags in a string:
var str = Rule("Your format rule"); // Titles
return str.match(/\<br\>/g).length;
Or you could assign that to a variable and move your static text like so:
var titles = Rule("Your format rule");
var breaks = titles.match(/\<br\>/g).length; // Number of breaks
var email = "<br>static@emailaddress.com";
return (breaks < 4) ? title + email : title + email.replace("<br>","<br><br>");
Does the job fail as soon as you submit it or does it compose some records and then fail?
The former would lead me to believe that it's an issue with Producer (though I wouldn't think file size would have any impact on that) while the latter would hint at not having enough RAM on the Producer computer to compose the job.
You could also split the data files into chunks and compose that way.
When defining your data source:
"Specify a data source definition" Click Next
"None" Click Next
Click Finish
Create an OnJobStart callback rule and put this in it:
FusionPro.Composition.composeAllRecords = false;
FusionPro.Composition.endRecordNumber = 100; // number of copies
Create a blank text rule that will return the sequence number and then put it in a text frame on the first page:
return FormatNumber("000",CurrentRecordNumber());
You can try this:
var imposheet = FusionPro.Composition.impositionSheetNumber;
var numOfBacks = 7; // Total number of backs you want to pull in
var back = (imposheet%numOfBacks == 0) ? numOfBacks : imposheet%numOfBacks;
return Resource("B " + back + ".pdf");
I would put the code mentioned in my previous post in a graphic rule and apply it to a graphic frame on the first page. And just add this to the OnRecordStart rule:
FusionPro.Composition.repeatRecordCount = 1124;
Oh I see. Maybe try repeating the record 1,124 times (the number of pages in your PDF) and then defining the page number of the PDF by the repeat record number? Like this:
var pdf = CreateResource("yourPDFfile.pdf");
pdf.countPages;
pdf.pagenumber = FusionPro.Composition.repeatRecordNumber;
return pdf;
Someone else can probably post a cleaner way to do this, but I think this would work for you:
var chunkHeight = 251; // Number in a chunk
var rec = FusionPro.Composition.inputRecordNumber;
var batch = (rec%chunkHeight == 0) ? Math.floor(rec/chunkHeight) : Math.floor(rec/chunkHeight) + 1;
var chunkSeq = (rec%chunkHeight == 0) ? chunkHeight : rec%chunkHeight;
// Format chunkSeq and prepend batch number
var seq = batch + FormatNumber("000",chunkSeq);
return seq;
The irony of your user name and the problem expressed in this post is overwhelming.
Do you have "use legacy line leading" checked in the global settings of the paragraph settings?
I don't think there is a way for FusionPro to mirror the text.
I think you could create a font in a program such as Fontographer and mirror the letters. Then you could reverse the string and return it in your custom font using the following code:
var str = Field("YOUR FIELD");
return str.split("").reverse().join("");
Couldn't you just get rid of that function and use the "smallcap" tags?
for (var i in FusionPro.Fields)
FusionPro.Composition.AddVariable(i, Field(i).replace(/(\d+)/g,'<smallcap>$1</smallcap>'), true);
Couple of issues I see here. First, you are setting the value of the "WelcomePackageCode" to all lowercase and then searching it for uppercase letters. Secondly, I think you also need to escape spaces in your path. I think you could simplify your code to look like this:
outpath = "c:\\Files\\7-7\ to\ Print\\" + Field("WelcomePackageCode") + "\\";
filename = Field("WelcomePackageCode") + " " + Field("LastnameRP") + "_" + Field("firstnameRP") + " " + Field("SubscriberID");
outfile = outpath + filename;
if (FieldChanged("WelcomePackageCode"))
FusionPro.Composition.OpenNewOutputFile(outfile + "." + FusionPro.Composition.outputFormatExtension);
Several ways you could accomplish this. Probably the simplest solution:
In the text editor window, highlight the paragraph you wish to suppress and click the "paragraph" button, check the "Suppress if" box, and select "Containing empty variables" from the drop-down menu.
Are you using FP 8.1 or later? If not, that won't work.
If you are, make sure that the frame you want to fill the color with is called "Box" and make sure that you have that code in an OnRecordStart Callback rule.