Lurker News

Comments (265) 53 threads

Earlier comments
pseingatl1 reply#
I don't understand why so many people think "pdf" automatically means "A4" or "letter size" document. PDF's are size agnostic. Storage is cheap and so is processing power. A phone-sized pdf will be 20 mb instead of 1 mb, but so what? It's a small price to pay for quality typesetting. Similarly, pdf's can be sized for the now typical 16:9 laptop screen.
ospider#
Because 99 percent* of PDF is A4 sized.

* From my observation and guess.

aforwardslash1 reply#
Shameless plug - https://github.com/zipreport

OSS Python library to generate PDF reports from HTML, using pagedjs. Uses Jinja templates, supports runtime-generated images, client-side JS, and reports are bundled as a single file.

abhinav22#
Anything with paged.js makes me an auto fan :)

This could be very interesting for those with Python workflows, thanks for sharing

sonthonax1 reply#
Weasyprint is great, but be prepared to start hacking its layout engine for more complex generations.

It's nowhere near as mature as PrinceXML.

runxel1 reply#
True, it sometimes can get messy to get a decent output. But the dev team behind is currently working on replacing Cairo with a custom Python solution as layouting engine. This will hopefully solve a lot of headaches down the road.

Sure, PrinceXML is unmatched. Same goes for the price tag. I know professional CAD software which costs less. Really not doable for smaller offices e.g.
Its astonishing that there is no real, great open source alternative for this. Don't get me wrong, Weasyprint is great, but has _a lot_ of dependencies and is a nightmare to install on Windows. Works decent on WSL, tho.

adamjhyde4 replies#
You need to try pagedjs. Which is kinda what this thread is all about.

Continue this thread — 4 replies

Klasiaster#
True, and it's amazing what can be done with plain CSS, like `-weasy-hyphens: auto;` or page counters. And for LaTex-style math there are pandoc filters to generate embedded SVGs on the fly.
abhinav22#
Thanks!

Yes I know what you mean - it doesn’t work well in certain browsers, devices etc. Aimed at desktop users and Chrome in particular (I saw a bug in Safari version). The aim is less to be a readable pdf in-browser, but rather a high quality pdf after exporting to pdf. The in browser print preview is just a nice side effect (but I might actually reuse this for other projects as I like it quite a bit!).
I think the issue with the toc is that it’s dynamically created; so while I was able to use responsive web design for the rest, it didn’t work so well for the toc. I’ll have a look at it though :) I think there may be a way to get it to work

Load more comments