Page MenuHomePhabricator

Investigate technical possibilities to render Collections using the Electron PDF service
Closed, ResolvedPublic

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 1 2016, 3:36 PM
Addshore moved this task from Incoming to Tables in pdfs on the TCB-Team board.Nov 2 2016, 9:00 AM
Tobi_WMDE_SW moved this task from Proposed to Todo on the WMDE-QWERTY-Team board.Nov 2 2016, 10:09 AM

Probably worth to have a look at the outcome of the investigation here: T142204: Investigate what is needed to use browser based rendering for books

Since the Electron service supports posting a whole HTML blob instead of providing a URL of a page to render, we could use this to let Electron render collections.
In order to do so, we would need to generate the final HTML for the collection and send it to the electron service via POST request. How the HTML could be generated and what processing and cleaning-up is needed, is explained nicely in T142204#2557594.
What's not explicitly mentioned there, is that we would need to turn any relative URLs into absolute URLs in the HTML in order to allow Electron to download resources (e.g. images), etc.

IMO it's possible to render collections using Electron, however it would require significant amount of effort. If we are going to work on this, I suggest we add Electron support in the Collection extension or at least re-use major parts of the collection logic from the extension.

Another - and maybe even better - approach that @daniel was coming up with in our last storytime meeting:
Have a SpecialPage that generates and displays the book/collection (several articles with TOC and references) as HTML and then pass the URL to that SpecialPage to the Electron service in order to render it as PDF.

A bit more detail on the idea that Tobi just mentioned:

The special page would use a Lua module to generate wikitext for a entire book(let) from a lit of pages. Maybe it would be possible to pick a Lua module, and perhaps also a style sheet to apply. The result can then be rendered using Electron.

The Lua module provides flexibility, and allows things like a cover page and a table of contents to be added in a way consistent with how wiki pages are generally created and rendered.

Addshore closed this task as Resolved.Nov 22 2016, 3:20 PM
Addshore claimed this task.
Addshore moved this task from Done to Demoed on the WMDE-QWERTY-Team board.
Restricted Application added a project: User-Addshore. · View Herald TranscriptJun 7 2017, 12:01 PM