pdf = PdfFormat(wldoc, teacher=True).build()
self.pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
- def build_weasy_pdf(self, **kwargs):
- from .publish import WeasyFormat
+ def build_pdf_from_html(self, **kwargs):
+ from .publish import PdfFromHtmlFormat
wldoc = self.wldocument()
- pdf = WeasyFormat(wldoc, media_root=settings.MEDIA_ROOT, **kwargs).build()
+ pdf = PdfFromHtmlFormat(
+ wldoc, media_root=settings.MEDIA_ROOT,
+ html_to_pdf_command=settings.HTML_TO_PDF_COMMAND,
+ **kwargs).build()
self.weasy_pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
def add_to_zip(self, zipf, student=False, prefix=''):
from librarian import DocProvider, IOFile
from librarian.pyhtml import EduModuleFormat
from librarian.pypdf import EduModulePDFFormat
-from librarian.weasy import EduModuleWeasyFormat
+from librarian.pdf_from_html import EduModulePdfFromHtmlFormat
from .models import Lesson, Attachment
from fnpdjango.utils.text.slughifi import slughifi
return src_img
-class WeasyFormat(EduModuleWeasyFormat):
+class PdfFromHtmlFormat(EduModulePdfFromHtmlFormat):
IMAGE_FORMATS = ('PNG', 'JPEG', 'GIF')
DEFAULT_IMAGE_WIDTH = 1600