jake_mckenna
ServiceNow Employee

In Jakarta and Kingston, the best way to add a page break was to invoke a new function added in the GeneralPDF script include to add this functionality to the generator. Below is what i had to do, and will admit this was a customization to the OOB since i edited the GeneralPDF script includes.



In GeneralPDF i changed the addHTML function to look like this around line 290:


var objects = this.htmlWorker.parseToList(contentReader);



for ( var i = 0; i < objects.size(); i += 1) {


var element = objects.get(i);


if(element.toString() == "[{!Page_Break}]") {


//adding a new page if this element is found!


this.document.addNewPage();


} else {


this.document.add(element);


}


}


In my template i added a line like this in the necessary spot:


{!Page_Break}