render-vendor ships with PhantomRenderer, a Renderer implementation that uses a long-lived, parallel renderer process to load, manage, and render Pages.

We recommend using a ChromeRenderer whenever possible, as it implements more modern web standards & APIs, and its architecture is less prone to memory leaks. However, some use cases may be better suited to Phantom’s environment. The PhantomRenderer can achieve similar rendering speeds as the ChromeRenderer, so using it should not significantly impact performance.

⚠ BE CAREFUL: the PhantomRenderer boots a parallel PhantomJS process. It is not bound to your REPL / application’s lifecycle. Make sure to destroy() any PhantomRenderers you create.

PhantomRenderers extend the base Renderer class to support the following options:

#### Renderer#load(id, options):

PhantomRenderers may load HTML documents, either from raw HTML data passed in the load request, or fetched from a provided URL.

Several additional options will affect the initial paint, so they must be provided at load time.

 Key Type Default value Description url* String - URL to load in the PhantomJS page. html* String - 8180 HTML source to set on the PhantomJS page. dpi Number - Configure rendered dpi, for non-px size values. zoomFactor Number - Scales images when not rendering PDFs. viewportSize { width, height } - Sets viewport size to the provided width + height values.

*At least one of html or url is required. html will take priority over url.

#### [Page#render](/pages/page#render):

At render time, PhantomRenderers accept two options, which are used to make any final adjustments to the presented document’s rendered output: