The Achilles heel pf PDF's are they don't have responsive layouts. It's so bad the Adobe team created an AI to resize layouts, yes an AI in the cloud, available only on the Adobe app. How insanely bad is your file format that you need an AI to resize layouts in 2021? If anyone has had to handle layouts programmatically I'd think they would agree that PDF's are the most outdated ass backwards file format in existence.
PDF is an attempt at non-Turing complete, simpler PostScript (PS). It comes from a time of paged media de facto ruling the world. Changing layouts was never the goal, because PDF was the output format.
In case of academic research papers typeset with LaTeX, the source file is something you'd likely want to consider the semantic equivalent of HTML. TeX should be able to render the same document with different output constraints ("responsive layout"), but because of the architecture (TeX itself is fully Turing complete), it is pretty slow at re-rendering an entire document. Part of the allure of a static document format like PDF is that you can, in theory, fetch just page 454 of 6000 page document and render that: with HTML, just like with TeX, you'd have to get and render the entire document to be certain that the layout won't change after you've processed the whole file.
The option to specify the target output size / dimensions at generation time is a reasonable option --- ISO A4 / US Letter, perhaps a target for smaller devices (though a 6"--7"+ tablet should be able to present most reasonably-formatted PDF documents reasonably legibly). For anything smaller, PDF isn't really well-suited, and your better option is to go with a fluid-layout format such as ePub, .mobi, or, yes, HTML. Having largely switched to bookreaders (eInk tablets), in large format with ~300 DPI grayscale screens, I strongly prefer fixed-layout formats such as PDF and DJVU to fluid-layout formats, for the spatial/cognitive reasons many others have mentioned in this thread.
Rigid formats sound great but that's unfortunately it's not 1985. Almost every document across most major industries is in .pdf and benefits from mutli size output(print, desktop, mobile). Adobe would not have spend millions in their assinine AI if this wasn't a problem. No one in the "insert any industry sector here" is using secure html document's to sends files, or any other format.
"Secure documents" is a whole 'nother ball of wax, and has no bearing on this specific question. PDFs themselves address that use-case poorly as well.
My (and others') point is and remains that a spatially-fixed layout does serve a useful purpose for some documents. Including the 140 million or so published books and an even larger count of formatted published articles. Yes, for short texts, dynamic flow within an HTML webpage is useful. Yes, for very small devices, virtually any format sucks and blows (this is a device problem, not an inherent PDF problem). I'm not a fan of websites that dump what should be Web-formatted content as PDFs. But I'm also not a fan of the notion that everything should be an HTML document either. (I've used various online document formats for going on 40 years, from raw ASCII (or EBCDIC) through roff/nroff/troff/groff, HTML, LaTeX, various flavours of Markdown, etc. I've hand typed out several books simply to have a suitable online digital format of them (I hope this serves to indicate my level of obsessiveness, if not sanity, on this topic). I'm a huge fan of Pandoc and its ability to take a standard markup format and produce a wide range of output endpoints (usually: PDF, ePub, HTML, plain ASCII text, though a few others may be included). I'm also a recent convert to large-format eBook readers. And from that experience I can make two specific observations: 1. The behaviour of HTML and web browsers on an eInk device really sucks. Pagination and not triggering scroll actions with the merest suggestion of a hint of breathing on the surface is hugely underappreciated. 2. PDFs (or equivalent paginated documents, e.g., DJVU) offer an excellent reading experience on such devices. I'm not a huge fan of the PDF file format, mind, it's far too variable and has too many surprises and vulnerabilities. As a reading medium, however, it's quite good, especially when produced with competent tools.
Thanks for flagging. It’s aimed for desktop users and a reasonable size screen (eg A4 or so), it’s not really a responsive design as it’s meant to be a tool to generate PDFs. So it won’t work in some browser dimensions (the paged.js code is reasonably complex).
That said it works in iOS as far as I can test. For some reason page numbers in table of contents not working perfectly in Safari but Chrome works pretty well. I guess the conclusion is that this is aimed somewhat to desktop Chrome users as a specific tool for pdf generation.
Does anyone know how this compares to PrinceXML / DocRapotor? We pay them big bucks for PDF generation (invoices specifically) and so far we haven't found anything comparable.
I was a huge supporter of PrinceXML / DocRaptor for precisely the same reason - all the alternatives (that I knew at the time) were not good.
Paged.js was a revelation (thanks to HN for telling me about it!). It is based off CSS Print Specifications like PrinceXML (as is my understanding - I’m about 95% sure), and to me it’s even better because it utilizes all the other front end technologies directly from your browser - I think there are some use cases where PrinceXML won’t be able to get the same functionality. For invoices, I think you should be able to easily switch over. Based on what I can see.
I also pay a lot per month to DocRaptor and they’ve been very reliable to date, but unless I’m rendering charts with JS I feel like I’m really overspending
Not sure about paged.js, but we use Weasyprint for invoices. It isn’t as advanced as some of the paid options (most annoyingly page headers are somewhat hacky) but it works very well.
My go-to for everything CSS Paged Media is [0] which has a nice comparison of supported features at [1]. They recently added Weasyprint, PagedJS and Typeset.sh [0]: https://css.paged.media/ [1]: https://css.paged.media/lessons
A few years ago I started an alternative to PrinceXML called ReLaXed.js [1], it's always been sufficient for my reports but it may lack some pagination/layout features that Paged.js may have as they seem to have given this much more thoughts (still wrapping my head around whether paged.js could be "plugged into" Relaxed).
Have you tried using Chromium print-to-pdf by an API like Puppeteer or Playwright? Combined with something like paged.js and a decent print stylesheet, you can get pretty good quality output.
Comments (265) 53 threads
Earlier commentsIn case of academic research papers typeset with LaTeX, the source file is something you'd likely want to consider the semantic equivalent of HTML. TeX should be able to render the same document with different output constraints ("responsive layout"), but because of the architecture (TeX itself is fully Turing complete), it is pretty slow at re-rendering an entire document.
Part of the allure of a static document format like PDF is that you can, in theory, fetch just page 454 of 6000 page document and render that: with HTML, just like with TeX, you'd have to get and render the entire document to be certain that the layout won't change after you've processed the whole file.
The option to specify the target output size / dimensions at generation time is a reasonable option --- ISO A4 / US Letter, perhaps a target for smaller devices (though a 6"--7"+ tablet should be able to present most reasonably-formatted PDF documents reasonably legibly).
For anything smaller, PDF isn't really well-suited, and your better option is to go with a fluid-layout format such as ePub, .mobi, or, yes, HTML.
Having largely switched to bookreaders (eInk tablets), in large format with ~300 DPI grayscale screens, I strongly prefer fixed-layout formats such as PDF and DJVU to fluid-layout formats, for the spatial/cognitive reasons many others have mentioned in this thread.
My (and others') point is and remains that a spatially-fixed layout does serve a useful purpose for some documents. Including the 140 million or so published books and an even larger count of formatted published articles.
Yes, for short texts, dynamic flow within an HTML webpage is useful. Yes, for very small devices, virtually any format sucks and blows (this is a device problem, not an inherent PDF problem).
I'm not a fan of websites that dump what should be Web-formatted content as PDFs. But I'm also not a fan of the notion that everything should be an HTML document either.
(I've used various online document formats for going on 40 years, from raw ASCII (or EBCDIC) through roff/nroff/troff/groff, HTML, LaTeX, various flavours of Markdown, etc. I've hand typed out several books simply to have a suitable online digital format of them (I hope this serves to indicate my level of obsessiveness, if not sanity, on this topic). I'm a huge fan of Pandoc and its ability to take a standard markup format and produce a wide range of output endpoints (usually: PDF, ePub, HTML, plain ASCII text, though a few others may be included).
I'm also a recent convert to large-format eBook readers. And from that experience I can make two specific observations:
1. The behaviour of HTML and web browsers on an eInk device really sucks. Pagination and not triggering scroll actions with the merest suggestion of a hint of breathing on the surface is hugely underappreciated.
2. PDFs (or equivalent paginated documents, e.g., DJVU) offer an excellent reading experience on such devices.
I'm not a huge fan of the PDF file format, mind, it's far too variable and has too many surprises and vulnerabilities. As a reading medium, however, it's quite good, especially when produced with competent tools.
That said it works in iOS as far as I can test. For some reason page numbers in table of contents not working perfectly in Safari but Chrome works pretty well.
I guess the conclusion is that this is aimed somewhat to desktop Chrome users as a specific tool for pdf generation.
Rest seems to work on Safari - let me know if any other issues and I’ll fix / update accordingly
Paged.js was a revelation (thanks to HN for telling me about it!). It is based off CSS Print Specifications like PrinceXML (as is my understanding - I’m about 95% sure), and to me it’s even better because it utilizes all the other front end technologies directly from your browser - I think there are some use cases where PrinceXML won’t be able to get the same functionality.
For invoices, I think you should be able to easily switch over. Based on what I can see.
My go-to for everything CSS Paged Media is [0] which has a nice comparison of supported features at [1]. They recently added Weasyprint, PagedJS and Typeset.sh
[0]: https://css.paged.media/
[1]: https://css.paged.media/lessons
[1] https://github.com/RelaxedJS/ReLaXed
All comments shown.
Couldn't load more comments. Check your connection and try again.