简体   繁体   中英

How to fix width and height of the image in the react-CKEditor component?

How to reduce the size of the image from original image size in CKEditor.

 <button type='button' className="ml-2 mr-0 btn btn-primary" onClick={this.logSig.bind(this)}>submit</button>

  logSig = () => {

    const signaturedata = this.signaturePad.toDataURL();
    const signatureImg = '<img alt src=' + signaturedata + '/> ';
    const { editorContent, signDialogOpenedFor } = this.state;

    let elem = editorContent ? this.getElemForPDF(editorContent, signDialogOpenedFor, signatureImg) : signatureImg;

    this.setState({
        openSignatureDialog: false,
        signDialogOpenedFor: '',
        editorContent:elem
    });
}

we are inserting the signature image from the dialog box to the editor.

in the editor after inserting the image it is of size 300 * 150

From image-2 from size 300 * 150 i need to fix it with 200 * 100 in the editor. Thanks in advnace

您不能只在您的签名图像常量中添加宽度和高度吗?

    const signatureImg = '<img alt src=' + signaturedata + ' width=200 height=100/> ';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM