Options
All
  • Public
  • Public/Protected
  • All
Menu

when a page is rendered, use these settings.

Hierarchy

  • IRenderSettings

Index

Properties

Optional clipRectangle

clipRectangle: IClipOptions

This property defines the rectangular area of the web page to be rasterized when using the requestType of png or jpeg. If no clipping rectangle is set, the entire web page is captured. Beware: if you capture too large an image it can cause your request to fail (out of memory). you can choose any dimensions you wish as long as you do not exceed 32M pixels new for Chrome: as an alternative to clipRect, specify IRenderSettings.selector to automatically set the viewport.

Optional emulateMedia

emulateMedia: "screen" | "print"

new for Chrome backend. (not available on WebKit). override the CSS media type of the page.

default

"screen"

Optional extraResponseHeaders

extraResponseHeaders: object

BEWARE: setting custom headers can corrupt your response, making it appear to fail when it did not. use with care. custom response headers you want sent along with your response. For example, to rename the file being downloaded, you can add 'Content-Disposition: attachment; filename="downloaded.pdf"'

Type declaration

  • [name: string]: string

Optional omitBackground

omitBackground: boolean

new for Chrome backend. (not available on WebKit). If true, and outputting a PNG, will hide the default white background (useful for capturing transparency). If true and outputting a PDF, will hide the background graphics altogether.

default

false

Optional passThroughHeaders

passThroughHeaders: boolean

If true, we will pass through all headers received from the target URL. However, we do not pass through "content-" and "transfer-" headers, except for "Content-Type" if you render "html". Please note: this can potentially corrupt your response, so use with caution. extraResponseHeaders override these headers.

default

false

Optional passThroughStatusCode

passThroughStatusCode: boolean

new for Chrome backend. (not available on WebKit).

if true, will pass the content statusCode, irrespective of if your api call was successful.

Note: you can always check the target URL's status code by inspecting the pjsc-content-status-code response header.

Optional pdfOptions

pdfOptions: IPdfOptions

settings useful for generating PDF's

Note: by default, when generating a PDF we set the IRenderSettings.emulateMedia="screen" property. Consider setting IRenderSettings.emulateMedia="print" for a more print-friendly PDF

example
{ format: "A4",
headerTemplate:"<div style='color:blue;font-size:18px;'><div class='pageNumber'>0</div>/<div class='totalPages'>0</div></div>",
landscape:true,
preferCSSPageSize:true,
pageRanges:"1-3",     }

Optional pngOptions

pngOptions: IPngOptions

optional png quality options passed to PngQuant. you must set pngOptions.optimize=true to enable these, otherwise the original non-modified png is returned.

Optional quality

quality: number

jpeg quality. 0 to 100. default 70. ignored for png, use pngOptions to set png quality.

Optional renderIFrame

renderIFrame: string
deprecated

for WebKit backend only. not supported in Chrome. use clipRectangle.selector instead. specify an IFrame to render instead of the full page. must be the frame's name.

Optional selector

selector: string

new for Chrome backend. (not available on WebKit).

as an alternative to clipRectangle you may pass a CSS selector. such as "h1", and the bounding rectangle of that element will be used.

CSS selectors are like JQuery. For help, please see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors

For PlainText or Html, you can pass a selector which will render only the specified element.

For image rendering (jpeg/png) You may also send the send the special "_viewport" selector

note: selector takes precidence over any clipRectangle settings.

Optional viewport

viewport: object

size of the browser in pixels

Type declaration

  • Optional deviceScaleFactor?: number

    new for Chrome backend. (not available on WebKit).

    set screen dpi scaling. default is 1.

  • Optional hasTouch?: boolean

    new for Chrome backend. (not available on WebKit). if touch events are supported

    default

    false

  • height: number

    by default, height is not used when taking screenshots (png/pdf). The image will be as tall as required to fit the content. To customize your screenshot dimensions, use the IRenderSettings.clipRectangle property.

  • Optional isLandscape?: boolean

    new for Chrome backend. (not available on WebKit). if landscape mode is used

    default

    false

  • Optional isMobile?: boolean

    new for Chrome backend. (not available on WebKit). if set, the meta viewport tag is used

    default

    false

  • width: number

Optional zoomFactor

zoomFactor: number

This property specifies the scaling factor for the screenshot (requestType png/pdf) choices. The default is 1, i.e. 100% zoom. Use [[viewport.deviceScaleFactor]] if you need to control screen DPI