pdfire-client / io.pdfire.client / ConversionParameters

ConversionParameters

class ConversionParameters : Parameters

Configuration for a conversion.

Options may require a minimum subscription tier to be usable. See the documentation for information on the available options.

Constructors

<init>

ConversionParameters(html: String? = null, url: String? = null, cdn: Boolean? = null, storage: StorageParameter? = null, landscape: Boolean? = null, printBackground: Boolean? = null, scale: Float? = null, format: PaperFormat? = null, paperWidth: String? = null, paperHeight: String? = null, margin: String? = null, marginTop: String? = null, marginRight: String? = null, marginBottom: String? = null, marginLeft: String? = null, pageRanges: MutableList<String> = mutableListOf(), headerTemplate: String? = null, footerTemplate: String? = null, preferCSSPageSize: Boolean? = null, viewportWidth: Float? = null, viewportHeight: Float? = null, blockAds: Boolean? = null, selector: String? = null, waitForSelector: String? = null, waitForSelectorTimeout: Duration? = null, waitUntil: WaitUntil? = null, waitUntilTimeout: Duration? = null, delay: Duration? = null, timeout: Duration? = null, headers: MutableMap<String, Any> = mutableMapOf(), emulateMedia: Media? = null, ownerPassword: String? = null, userPassword: String? = null, allowErrorPage: Boolean? = null, optimize: Boolean? = null)

Configuration for a conversion.

Properties

allowErrorPage

var allowErrorPage: Boolean?

Allow HTTP status codes outside the 2xx range to be captured.

blockAds

var blockAds: Boolean?

Indicates if the browser should try to remove ads from the page.

cdn

var cdn: Boolean?

Indicates if the PDF should be served via the CDN.

delay

var delay: Duration?

Delay the capturing of the page for this duration.

emulateMedia

var emulateMedia: Media?

Which CSS media to emulate.

footerTemplate

var footerTemplate: String?

HTML template for the PDF footer.

format

var format: PaperFormat?

Paper format.

headerTemplate

var headerTemplate: String?

HTML template for the PDF header.

headers

var headers: MutableMap<String, Any>

Custom HTTP headers that will be attached to the request from the PDFire service to the provided URL.

html

var html: String?

The HTML string to convert to a PDF.

landscape

var landscape: Boolean?

Indicates if the page should be captured in landscape mode.

margin

var margin: String?

Margins of the page.

marginBottom

var marginBottom: String?

Bottom margin of the page (overrides margin).

marginLeft

var marginLeft: String?

Left margin of the page (overrides margin).

marginRight

var marginRight: String?

Right margin of the page (overrides margin).

marginTop

var marginTop: String?

Top margin of the page (overrides margin).

optimize

var optimize: Boolean?

Apply CSS optimizations to the page.

ownerPassword

var ownerPassword: String?

Secures the PDF with an owner password.

pageRanges

var pageRanges: MutableList<String>

Page ranges that should be captured.

paperHeight

var paperHeight: String?

Paper height.

paperWidth

var paperWidth: String?

Paper width.

preferCSSPageSize

var preferCSSPageSize: Boolean?

Indicates if the page's CSS rule should take precedence over the paperWidth, paperHeight and format options.

printBackground

var printBackground: Boolean?

Indicates if the background images of the page should be included in the PDF.

scale

var scale: Float?

Sets the zoom of the page.

selector

var selector: String?

DOM selector for the HTML element that should be captured.

storage

var storage: StorageParameter?

Storage configuration for the PDF.

timeout

var timeout: Duration?

General timeout for the conversion request.

url

var url: String?

The URL to convert to a PDF.

userPassword

var userPassword: String?

Secures the PDF with a user password.

viewportHeight

var viewportHeight: Float?

Height of the browser's viewport.

viewportWidth

var viewportWidth: Float?

Width of the browser's viewport.

waitForSelector

var waitForSelector: String?

DOM selector the service should wait for before capturing the page.

waitForSelectorTimeout

var waitForSelectorTimeout: Duration?

Timeout for the waitForSelector option.

waitUntil

var waitUntil: WaitUntil?

Browser event to wait for before capturing the page.

waitUntilTimeout

var waitUntilTimeout: Duration?

Timeout for the waitUntil option.

Functions

addPageRange

fun addPageRange(range: String): Unit

Add page ranges that should be captured.

secure

fun secure(owner: String? = null, user: String? = null): Unit

Secure the PDF with an owner / user password.

setMargin

fun setMargin(margin: Int): Unit

Set the margins of the PDF in pixel.

setMarginBottom

fun setMarginBottom(margin: Int): Unit

Set the bottom margin of the PDF in pixel.

setMarginBottomCentimeter

fun setMarginBottomCentimeter(margin: Float): Unit

Set the bottom margin of the PDF in centimeter.

setMarginBottomInch

fun setMarginBottomInch(margin: Float): Unit

Set the bottom margin of the PDF in inches.

setMarginBottomMillimeter

fun setMarginBottomMillimeter(margin: Float): Unit

Set the bottom margin of the PDF in millimeter.

setMarginBottomPixel

fun setMarginBottomPixel(margin: Float): Unit

Set the bottom margin of the PDF in pixel.

setMarginCentimeter

fun setMarginCentimeter(margin: Float): Unit

Set the margins of the PDF in centimeter.

setMarginInch

fun setMarginInch(margin: Float): Unit

Set the margins of the PDF in inches.

setMarginLeft

fun setMarginLeft(margin: Int): Unit

Set the left margin of the PDF in pixel.

setMarginLeftCentimeter

fun setMarginLeftCentimeter(margin: Float): Unit

Set the left margin of the PDF in centimeter.

setMarginLeftInch

fun setMarginLeftInch(margin: Float): Unit

Set the left margin of the PDF in inches.

setMarginLeftMillimeter

fun setMarginLeftMillimeter(margin: Float): Unit

Set the left margin of the PDF in millimeter.

setMarginLeftPixel

fun setMarginLeftPixel(margin: Float): Unit

Set the left margin of the PDF in pixel.

setMarginMillimeter

fun setMarginMillimeter(margin: Float): Unit

Set the margins of the PDF in millimeter.

setMarginPixel

fun setMarginPixel(margin: Float): Unit

Set the margins of the PDF in pixel.

setMarginRight

fun setMarginRight(margin: Int): Unit

Set the right margin of the PDF in pixel.

setMarginRightCentimeter

fun setMarginRightCentimeter(margin: Float): Unit

Set the right margin of the PDF in centimeter.

setMarginRightInch

fun setMarginRightInch(margin: Float): Unit

Set the right margin of the PDF in inches.

setMarginRightMillimeter

fun setMarginRightMillimeter(margin: Float): Unit

Set the right margin of the PDF in millimeter.

setMarginRightPixel

fun setMarginRightPixel(margin: Float): Unit

Set the right margin of the PDF in pixel.

setMarginTop

fun setMarginTop(margin: Int): Unit

Set the top margin of the PDF in pixel.

setMarginTopCentimeter

fun setMarginTopCentimeter(margin: Float): Unit

Set the top margin of the PDF in centimeter.

setMarginTopInch

fun setMarginTopInch(margin: Float): Unit

Set the top margin of the PDF in inches.

setMarginTopMillimeter

fun setMarginTopMillimeter(margin: Float): Unit

Set the top margin of the PDF in millimeter.

setMarginTopPixel

fun setMarginTopPixel(margin: Float): Unit

Set the top margin of the PDF in pixel.

setPaperHeight

fun setPaperHeight(height: Int): Unit

Set the paper height of the PDF in pixel.

setPaperHeightCentimeter

fun setPaperHeightCentimeter(height: Float): Unit

Set the paper height of the PDF in centimeter.

setPaperHeightInch

fun setPaperHeightInch(height: Float): Unit

Set the paper height of the PDF in inches.

setPaperHeightMillimeter

fun setPaperHeightMillimeter(height: Float): Unit

Set the paper height of the PDF in millimeter.

setPaperHeightPixel

fun setPaperHeightPixel(height: Float): Unit

Set the paper height of the PDF in pixel.

setPaperWidth

fun setPaperWidth(width: Int): Unit

Set the paper width of the PDF in pixel.

setPaperWidthCentimeter

fun setPaperWidthCentimeter(width: Float): Unit

Set the paper width of the PDF in centimeter.

setPaperWidthInch

fun setPaperWidthInch(width: Float): Unit

Set the paper width of the PDF in inches.

setPaperWidthMillimeter

fun setPaperWidthMillimeter(width: Float): Unit

Set the paper width of the PDF in millimeter.

setPaperWidthPixel

fun setPaperWidthPixel(width: Int): Unit

Set the paper width of the PDF in pixel.

toMap

fun toMap(): Map<String, Any?>

Create a map from the parameters.

useStorage

fun useStorage(configure: (StorageParameter) -> Unit): Unit

Serve the PDF via a custom cloud storage disk.

fun useStorage(use: Boolean = true): Unit

Serve the PDF via the default custom cloud storage disk.

waitUntilDOM

fun waitUntilDOM(): Unit

Wait for the browser's "DOMContentLoaded" event before capturing the page.

waitUntilLoad

fun waitUntilLoad(): Unit

Wait for the browser's "load" event before capturing the page.

withHeaders

fun withHeaders(headers: Map<String, Any>): Unit

Add custom headers to the request the PDFire server makes to the provided url.