Documentation Docs
Documentation Docs

IDocOptions

PDF document configuration. Pass it as the second argument to the SurveyPDF constructor:

const surveyPdf = new SurveyPDF.SurveyPDF(surveyJson, pdfDocOptions);

// In modular applications:
import { SurveyPDF } from "survey-pdf";
const surveyPdf = new SurveyPDF(surveyJson, pdfDocOptions);
applyImageFit property

Specifies whether to apply imageFit settings specified in the survey JSON schema to exported images.

Default value: false

This property applies the following settings:

If you enable the applyImageFit property, the quality of images may be lower because they pass through several conversions. If applyImageFit is disabled, exported images fill the entire container and do not preserve their aspect ratio, but their quality remains the same because they are exported as is.

Type:
boolean readonly
Implemented in:
IDocOptions
compress property

Specifies whether to compress the PDF document. Compressed documents do not support custom fonts.

Default value: false

Type:
boolean readonly
Implemented in:
IDocOptions
fontName property

Font name.

Possible values:

  • "Helvetica" (default)
  • "Courier"
  • "Times"
  • "Symbol"
  • "ZapfDingbats"
  • Custom font name

View Demo

Type:
string readonly
Implemented in:
IDocOptions
See also:
fontSize
fontSize property

Font size in points.

Default value: 14

Type:
number readonly
Implemented in:
IDocOptions
See also:
fontName
format property

Page format.

Possible values:

  • "a0" - "a10" ("a4" is default)
  • "b0" - "b10"
  • "c0" - "c10"
  • "dl"
  • "letter"
  • "government-letter"
  • "legal"
  • "junior-legal"
  • "ledger"
  • "tabloid"
  • "credit-card"
  • Array - custom page size in millimeters, for example, [210, 297].
Type:
string | {} readonly
Implemented in:
IDocOptions
See also:
orientation
htmlRenderAs property

Specifies how to render HTML questions into PDF.

Possible values:

  • "standard" - Render HTML questions as selectable text.
  • "image" - Render HTML questions as images.
  • "auto" (default) - Select between the "standard" and "image" modes automatically based on the HTML content.

You can override this property for an individual HTML question. Set the question's renderAs property to "standard" or "image" in the survey JSON schema.

Type:
IHTMLRenderType readonly
Implemented in:
IDocOptions
See also:
useCustomFontInHtml
isRTL property

Specifies whether the PDF document contains text in right-to-left languages.

Default value: false

Type:
boolean readonly
Implemented in:
IDocOptions
margins property

Page margins. Set this property to an object with the following fields: top, bot, left, right.

Type:
IMargin readonly
Implemented in:
IDocOptions
matrixRenderAs property

Specifies how to render Matrix, Matrix Dropdown, and Matrix Dynamic questions into PDF.

Possible values:

  • "list" - Render matrix-like questions as lists.
  • "auto" (default) - Render matrix-like questions as tables if they fit into the available space. Otherwise, render the questions as lists.

You can override this property for an individual matrix-like question. Set the question's renderAs property to "list" in the survey JSON schema.

Type:
"auto" | "list" readonly
Implemented in:
IDocOptions
orientation property

Page orientation.

Possible values:

  • "p" (default) - Portrait orientation.
  • "l" - Landscape orientation.
Type:
"p" | "l" readonly
Implemented in:
IDocOptions
See also:
format
readonlyRenderAs property

Specifies how to render read-only questions.

Possible values:

  • "text" - Render read-only questions as plain text and custom primitives.
  • "acroform" - Use Adobe AcroForms to render questions that support them as interactive form elements switched to their native read-only state. Other questions are rendered in "text" mode.
  • "auto" (default) - Prefer the "text" mode but use "acroform" for File Upload questions and links.
Type:
"auto" | "text" | "acroform" readonly
Implemented in:
IDocOptions

Specifies whether to include only selected choices when PDF Generator renders a Multi-Select Dropdown (Tag Box) question.

Default value: false (include all choices)

Type:
boolean readonly
Implemented in:
IDocOptions

Specifies whether to apply a custom font to HTML questions.

Default value: false

View Demo

Type:
boolean readonly
Implemented in:
IDocOptions
See also:
htmlRenderAs

Copyright © 2024 Devsoft Baltic OÜ. All rights reserved.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.