SurveyPDF
The SurveyPDF object enables you to export your surveys and forms to PDF documents.
Properties
Methods
Applies a visual style to UI elements in an exported PDF document.
This method accepts either an IDocStyle object that overrides properties in the default visual style, or a callback function that returns such an object. When a callback is used, it receives helper functions—getSizeVariable(name) and getColorVariable(name)—which allow you to derive dimensions and colors from the currently applied UI theme.
Customize Styling and Layout in PDF
- Type:
- (value: IDocStyle | ((options: { getColorVariable: (name: string) => string; getSizeVariable: (name: string) => number; }) => IDocStyle)) => void
- Parameters:
-
value, type: IDocStyle | ((options: { getColorVariable: (name: string) => string; getSizeVariable: (name: string) => number; }) => IDocStyle) ,
An
IDocStyleobject, or a callback function that returns anIDocStyleobject.
- Implemented in:
- SurveyPDF
An event that allows you to customize the visual style applied to a choice item in an exported PDF document.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.options.question:Question
A question to which the item belongs.options.item:ItemValue
A choice item whose style is being customized.options.getColorVariable:(name: string) => string
A helper function that returns the value of a color variable by name.options.getSizeVariable:(name: string) => number
A helper function that returns the value of a size variable by name.options.style.choiceText:ITextStyle
An object that defines the visual style applied to the item's text.options.style.input:ISelectionInputStyle
An object that defines the visual style applied to the item's input control.
Modify the properties of options.style.choiceText and options.style.input to control how the item is rendered in the exported PDF document.
Customize Individual Element Styles in PDF
- Type:
- EventBase<SurveyPDF, { question: Question; item: ItemValue; style: { choiceText: ITextStyle; input: ISelectionInputStyle; }; getColorVariable: (name: string) => string; getSizeVariable: (name: string) => number; }>
- Implemented in:
- SurveyPDF
An event that allows you to customize the visual style applied to a page in an exported PDF document.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.options.page:PageModel
A page whose style is being customized.options.getColorVariable:(name: string) => string
A helper function that returns the value of a color variable by name.options.getSizeVariable:(name: string) => number
A helper function that returns the value of a size variable by name.options.style:IPageStyle
An object that defines the page's visual style. Modify its properties to control how the page is rendered in the exported PDF document.
Customize Individual Element Styles in PDF
- Type:
- EventBase<SurveyPDF, { page: PanelModel; style: IPageStyle; getColorVariable: (name: string) => string; getSizeVariable: (name: string) => number; }>
- Implemented in:
- SurveyPDF
An event that allows you to customize the visual style applied to a panel in an exported PDF document.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.options.panel:PanelModel
A panel whose style is being customized.options.getColorVariable:(name: string) => string
A helper function that returns the value of a color variable by name.options.getSizeVariable:(name: string) => number
A helper function that returns the value of a size variable by name.options.style:IPanelStyle
An object that defines the panel's visual style. Modify its properties to control how the panel is rendered in the exported PDF document.
Customize Individual Element Styles in PDF
- Type:
- EventBase<SurveyPDF, { panel: PanelModel; style: IPanelStyle; getColorVariable: (name: string) => string; getSizeVariable: (name: string) => number; }>
- Implemented in:
- SurveyPDF
An event that allows you to customize the visual style applied to a question in an exported PDF document.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.options.question:Question
A survey question whose style is being customized.options.getColorVariable:(name: string) => string
A helper function that returns the value of a color variable by name.options.getSizeVariable:(name: string) => number
A helper function that returns the value of a size variable by name.options.style:IQuestionStyle
An object that defines the question's visual style. Modify its properties to control how the question is rendered in the exported PDF document.
Customize Individual Element Styles in PDF
- Type:
- EventBase<SurveyPDF, { question: Question; style: IQuestionStyle; getColorVariable: (name: string) => string; getSizeVariable: (name: string) => number; }>
- Implemented in:
- SurveyPDF
An event that is raised when SurveyJS PDF Generator renders a page header. Handle this event to customize the header.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.canvas:DrawCanvas
An object that you can use to draw text and images in the page header. View Demo
- Type:
- EventAsync<SurveyPDF, DrawCanvas>
- Implemented in:
- SurveyPDF
An event that is raised when SurveyJS PDF Generator renders a page. Handle this event to customize page rendering.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.options.page:PageModel
A page that is being rendered.options.point:IPoint
An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties:{ xLeft: number, yTop: number }.options.bricks:PdfBrick[]
An array of bricks used to render the element.options.controller:DocController
An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.options.repository:FlatRepository
A repository with classes that render elements to PDF. Use itscreatemethod if you need to create a new instance of a rendering class.
- Type:
- EventAsync<SurveyPDF, AdornersPageOptions>
- Implemented in:
- SurveyPDF
An event that is raised when SurveyJS PDF Generator renders a panel. Handle this event to customize panel rendering.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.options.panel:PanelModel
A panel that is being rendered.options.point:IPoint
An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties:{ xLeft: number, yTop: number }.options.bricks:PdfBrick[]
An array of bricks used to render the element.options.controller:DocController
An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.options.repository:FlatRepository
A repository with classes that render elements to PDF. Use itscreatemethod if you need to create a new instance of a rendering class.
- Type:
- EventAsync<SurveyPDF, AdornersPanelOptions>
- Implemented in:
- SurveyPDF
An event that is raised when SurveyJS PDF Generator renders a survey question. Handle this event to customize question rendering.
Parameters:
sender:SurveyPDF
ASurveyPDFinstance that raised the event.options.question:Question
A survey question that is being rendered.options.point:IPoint
An object with coordinates of the top-left corner of the element being rendered. This object contains the following properties:{ xLeft: number, yTop: number }.options.bricks:PdfBrick[]
An array of bricks used to render the element.options.controller:DocController
An object that provides access to main PDF document properties (font, margins, page width and height) and allows you to modify them.options.repository:FlatRepository
A repository with classes that render elements to PDF. Use itscreatemethod if you need to create a new instance of a rendering class.
- Type:
- EventAsync<SurveyPDF, AdornersOptions>
- Implemented in:
- SurveyPDF
An object that defines the visual style applied to UI elements in an exported PDF document.
To apply a new visual style to the PDF document, call the applyStyle method.
Customize Styling and Layout in PDF
- Type:
- IDocStyle readonly
- Implemented in:
- SurveyPDF
Send feedback to the SurveyJS team
Need help? Visit our support page