Closed djplaner closed 3 years ago
pip install Weasyprint
weasyprint URL PDFFile Failure on Windows with default install
success somewhat. Still need to run the Javascript on it.
FAILURE The javascript is not handled by Weasyprint - at least default
Suggestion is to use a Javascript pre-processor first.
Apparently PhantomJS is an option. But it isn't being maintained. The alternative is headless chrome or similar. i.e. something that works on the completed DOM after Javascript has run. e.g. Python + Selenium
Basically working. However, by default accordions can create some issues. Remove them and all ok.
What about expandAll? Could get selenium to click the expandAll button
These don't seem to working too well.
Comparison of XHTML2PDF, WeasyPrint and UnoConv
Python - source code Documentation
Seems to be able to be provided a HTML string.
Perhaps not as complete.
Is based on using OpenOffice. COuld be interetsing, but heavyweight.
Currently have a outside Python script that can generate PDFs using Weasyprint.
But the question is how to link this to course sites and keep it updated?
I could implement something, but it would require on-going work - a daily script running. But could try something with Lauren's course. See how it goes.o
Explore if Javascript librararies might provide a way to produce offline versions of Content Interface.
Javascript - appears the only options require either
And/or Python libraries that might be combined with screen scraping.
Rationale
The Word documents can contain styling and embedded documents that don't print well. They are applied on the web. If we're able to use those to generate PDF/DOC the styling will be applied
Current status
Weasyprint with Python script can produce a PDF that's close, but