import { IRect , ISize , DocController } from '../doc_controller' ; import { IQuestion , Question } from 'survey-core' ; import { SurveyHelper } from '../helper_survey' ; export interface IPdfBrick extends IRect , ISize { render ( ) : Promise < void > ; unfold ( ) : IPdfBrick [ ] ; isPageBreak : boolean ; } export class PdfBrick implements IPdfBrick { public xLeft : number ; public xRight : number ; public yTop : number ; public yBot : number ; /**
     * Size of text. Set 0 for auto size
     */ public fontSize : number ; public textColor : string = SurveyHelper . TEXT_COLOR ; public formBorderColor : string = SurveyHelper . FORM_BORDER_COLOR ; public isPageBreak : boolean = false ; public constructor ( protected question , protected controller , rect ) { this . xLeft = rect . xLeft ; this . xRight = rect . xRight ; this . yTop = rect . yTop ; this . yBot = rect . yBot ; this . fontSize = ! ! controller ? controller . fontSize : DocController . FONT_SIZE ; } public get width ( ) : number { return this . xRight - this . xLeft ; } public get height ( ) : number { return this . yBot - this . yTop ; } public async render ( ) { if ( ! ! this . question && this . question . isReadOnly && SurveyHelper . getReadonlyRenderAs ( < Question > this . question , this . controller ) !== 'acroform' ) { await this . renderReadOnly ( ) ; } else await this . renderInteractive ( ) ; } public async renderInteractive ( ) { } public async renderReadOnly ( ) { await this . renderInteractive ( ) ; } public unfold ( ) { return [ this ] ; } }