Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions easy_pdf/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import logging
import os

import io

from django.conf import settings
from django.template import loader
from django.http import HttpResponse
from django.utils.http import urlquote
from django.utils.six import BytesIO


import xhtml2pdf.default
from xhtml2pdf import pisa
Expand Down Expand Up @@ -58,8 +60,8 @@ def html_to_pdf(content, encoding="utf-8",
:rtype: :class:`bytes`
:raises: :exc:`~easy_pdf.exceptions.PDFRenderingError`
"""
src = BytesIO(content.encode(encoding))
dest = BytesIO()
src = io.BytesIO(content.encode(encoding))
dest = io.BytesIO()

pdf = pisa.pisaDocument(src, dest, encoding=encoding,
link_callback=link_callback, **kwargs)
Expand Down