Wkhtmltopdf. ContentNotFoundError

Необходимо текст из ckeditor в админ панели django собрать в pdf. Установил django-wkhtmltopdf и на первый взгляд всё работает, но, только если текста мало. Если же добавить текст на 10 страниц, то, получаю ContentNotFoundError.

Utils

def create_pdf(context):
    try:
        template = loader.get_template('pdf/sample.html')
    except:
        return

    temp_file = render_pdf_from_template(
        input_template=template,
        header_template=None,
        footer_template=None,
        context=context
    )
    filename = f'{context["title"]}.pdf'
    return ContentFile(temp_file, name=filename)

HTML

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>{{ title }}</title>
</head>
<body>
    <h3>{{ title }}</h3>
    <p>{{ header_contract|safe }}</p>
    <p>{{ body_contract|safe }}</p>
    <table>
        <tr>
            <td>{{ company_requisites }}</td>
            <td>
                <p>{{ requisites|linebreaks }}</p>
                <p><img src="{{ signature }}"></p>
            </td>
        </tr>
    </table>
</body>
</html>
Вернуться на верх