Print pdf from suneditor-react component html with proper styling in A4 sheet

51 views Asked by At

I'm trying to generate PDF from HTML which is sent from frontend using suneditor-react component. The issue I'm facing is when I send the template(HTML) from frontend and I use it to generate PDF, the styles change in the PDF because the screen in which I create the template(HTML) is of different size and the PDF is printed on A4 size sheet. So both have have different height and width. I want to make sure whatever I make in suneditor and send it to backend it should print like that only. This is the component code I'm using in my react app

<SunEditor
            setContents={editorContent}
            setDefaultStyle="height: 55vh"
            onChange={handleEditorChange}
            setOptions={{
              buttonList: [
                ['undo', 'redo'],
                ['bold', 'underline', 'italic', 'strike'],
                ['subscript', 'superscript'],
                ['font', 'fontSize', 'fontColor', 'hiliteColor'],
                ['removeFormat'],
                ['indent', 'outdent'],
                ['align', 'list', 'horizontalRule'],
                ['table', 'link', 'image'],
                ['fullScreen', 'codeView', 'preview', 'print'],
                ['formatBlock', 'paragraphStyle', 'lineHeight', 'textStyle'],
                ['imageGallery'],
              ],
            }}
          />
0

There are 0 answers