import { IQuestion } from 'survey-core' ; import { PdfBrick } from './pdf_brick' ; import { IRect , DocController } from '../doc_controller' ; export class HTMLBrick extends PdfBrick { private margins : { top : number ; bottom : number ; } ; public constructor ( question , controller , rect , protected html , isImage = false ) { super ( question , controller , rect ) ; if ( isImage ) { this . margins = { top : 0.0 , bottom : 0.0 } ; } else { this . margins = { top : controller . margins . top , bottom : controller . margins . bot } ; } } public async renderInteractive ( ) { let oldFontSize = this . controller . fontSize ; this . controller . fontSize = this . fontSize ; await new Promise < void > ( ( resolve ) => { this . controller . doc . fromHTML ( this . html , this . xLeft , this . yTop , { width : this . width , pagesplit : true , } , function ( ) { [ ] . slice . call ( document . querySelectorAll ( 'iframe' ) ) . forEach ( function ( el ) { if ( el . name . lastIndexOf ( 'jsPDFhtmlText' , 0 ) === 0 ) { el . parentNode . removeChild ( el ) ; } } ) ; resolve ( ) ; } , this . margins ) ; } ) ; this . controller . fontSize = oldFontSize ; } }