HTML convert to PDF not wysiwyg in Django

106 Views Asked by At

I'm trying to convert HTML to PDF using xhtml2pdf in django. I use ckeditor to input and in HTML it's look wysiwyg like this.

enter image description here

But after i convert to PDF, it looks like this.

enter image description here

Why in PDF is not same like in HTML ?

1

There are 1 best solutions below

0
Takafumi Shokonji On

I am facing the same issue. I am wondering if I need a css file like "ckeditor.css" when converting to PDF.

When I converted from html to pdf with pdfkit, it converted well as follows.

pdfkit.from_string(html, 'XXX.pdf', options=options,css='ckeditor.css')