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);
Properties
Methods
Events
Specifies whether to apply imageFit
settings specified in the survey JSON schema to exported images.
Default value: false
This property applies the following settings:
imageFit
to exported Image questionsimageFit
to exported Image Picker questionslogoFit
to an exported logo in the survey header
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
Specifies whether to compress the PDF document. Compressed documents do not support custom fonts.
Default value: false
- Type:
- boolean readonly
- Implemented in:
- IDocOptions
Font name.
Possible values:
"Helvetica"
(default)"Courier"
"Times"
"Symbol"
"ZapfDingbats"
- Custom font name
- Type:
- string readonly
- Implemented in:
- IDocOptions
- See also:
- fontSize
Font size in points.
Default value: 14
- Type:
- number readonly
- Implemented in:
- IDocOptions
- See also:
- fontName
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
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
Specifies whether the PDF document contains text in right-to-left languages.
Default value: false
- Type:
- boolean readonly
- Implemented in:
- IDocOptions
Page margins. Set this property to an object with the following fields: top
, bot
, left
, right
.
- Type:
- IMargin readonly
- Implemented in:
- IDocOptions
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
Page orientation.
Possible values:
"p"
(default) - Portrait orientation."l"
- Landscape orientation.
- Type:
- "p" | "l" readonly
- Implemented in:
- IDocOptions
- See also:
- format
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
- Type:
- boolean readonly
- Implemented in:
- IDocOptions
- See also:
- htmlRenderAs
Copyright © 2024 Devsoft Baltic OÜ. All rights reserved.