PDFreactor’s JavaScript engine also includes several proprietary extensions which introduces features that are relevant to paged media output especially if you are converting JavaScript based HTML to PDF. Browsers usually only focus on continuous output. One of the most important of such features are the Description objects. These objects describe a rectangle which represents layout positions and dimensions of a given document object. Description objects are explored in detail in the PDFreactor Web Service or PDFreactor Library manual.
There are various types of converted objects, such as converted, BoxDescription and LineDescription representing a single page, box or line, respectively. With these objects, you can access layout information during runtime. Using that information, it is possible to manipulate the document’s layout via JavaScript to create the final PDF. You can implement even complex logic to achieve use cases or requirements that would usually require dedicated design and publishing software.
Common use cases that can be enhanced when converting HTML to PDF using JavaScript are e.g. catalogs, flyers and books where there is sometimes the requirement to reduce blank space on a page. Using JavaScript, this space can be detected and then filled using external contents.