Lurker News

Comments (265) 53 threads

Earlier comments
austinjp1 reply#
Similar to some others here, I have folders full of PDFs. I recently discovered Recoll, which is great for searching them. Fuzzy search of contents as well as filenames.

https://www.lesbonscomptes.com/recoll/
As well as this, I have a script which find all .pdf files without a corresponding .txt file, then generates one with pdftotext. Really handy, I can then easily grep -ril or ag -til for contents. One gotcha: the text files have line breaks, meaning matches don't always work.

MilStdJunkie2 replies#
Asciidoctor has a web PDF tool that just went alpha a little bit ago, uses the same stack as the OP's thingie.

https://github.com/Mogztter/asciidoctor-web-pdf
The content handoff goes like this: Asciidoc (using defined roles) generates HTML5 (Pagedjs polyfills page areas / pagination stuff), CSS styles stuff, and Puppeteer runs a headless Chromium for the pdf render. It's straight from CSS GCPM W3C spec, a flavor of CSS Paged Media, drafts that have been percolating since frickin' 2006 but have never seen browser implementation.
The beauty of this is that you use the same CSS for web and PDF deliverables. Actually, the even better beauty is that you are using two dirt-common technology stacks - CSS and Javascript - instead of XSL or Prawn or some ancient bespoke layout language. With Asciidoctor, for complex print requirements you're going to be forced to either 1) DocBook-XSL via fopub or 2) DocBook-LaTeX via dblatex. The native Prawn-based PDF tool isn't capable of a whole lot of customization without extensions. So web-pdf is a real shot in the arm for those of us that aren't real keen on going back into XSL-FO.

adamjhyde1 reply#
also using pagedjs :) awesome!
MilStdJunkie#
Yeah, in the Python world there's WeasyPrint for PDF out in the wild as well. It's quite slick, but it's a harder sell because of Python, which corporate types seem to think is bad hacker central.

https://github.com/Kozea/WeasyPrint

gorgoiler1 reply#
Amazing news, thank you for sharing.

Prawn’s pure ruby implementation of image layout makes it too slow for the graphics heavy technical manuals I write (though I haven’t used asciidoctor-pdf in 12 months.) I ended up drafting documents with 10dpi images just to get it to render quickly enough for layout but even then, adding images turned a 100ms render into a 6000ms render.
Hopefully this problem goes away with a fast web based stack.
I’ve never had much luck with break-after/before:avoid for
. I hope their css or paged.js works for avoiding this common fault.

MilStdJunkie#
That's super interesting, I am in the same boat. Do you mind me asking what graphics format(s) you're using?

We're using a sort of hybrid Asciidoc/S1000D approach, Asciidoc markup with S1000D architecture (filenamers, publication modules, data module codes, etc). The art is SVG brought over from CGM, with conditional content (applicability) controlling the images via a new module type we call "illustration control files" that toggle the art based on "applicability" aka asciidoc document attributes and ifdef/ifevals.
PDF is via DocBook-XSL, but it's a scheduled process and not "on-click", which I am positive would break things. I am not even sure how to fire fopub from this company's web architecture; they wouldn't let us post html to a network directory (argh?), so any hopes of doing something more advanced are pretty low. In my off time I am looking at Antora pretty hard, and web-pdf is going to be the default pdf tool for that build platform. One thing I am wondering is how Antora's playbook files are going to relate to the "Ascii1000D" Publication Modules, which overlap a wee bit.

aviraldg#
(Somewhat) related self-promotion: I've found that converting from HTML(+YAML) to PDF is one of the best ways to create a resume. It's very easy to come up with a good design, you can separate data (YAML) and presentation (HTML and CSS), and also export different views over the underlying data with simple filters (e.g. when generating a resume to apply to a job, only include the experiences that are relevant)

The code is pretty terrible, but you can see an example (my resume) here:
* Data - https://github.com/aviraldg/aviraldg.github.io/blob/master/_...
* HTML - https://github.com/aviraldg/aviraldg.github.io/blob/master/r...

anonu5 replies#
This is one of the hardest problems we face as a financial research platform. We have a lot of financial data in tables along with line, bar and pie charts. Coming up with something sensible and readable is a bit harder than expected. Ultimately we have a "json to latex" converter we built but it's not great...
abhinav22#
I work in financial reporting, doing very similar things to what you mentioned here. Mind dropping me an email at Ashok.khanna@hotmail.com and we could discuss further? Would love to chat to others facing similar dilemmas :)
TimTheTinker#
May I recommend Prince? https://www.princexml.com/

I created a PDF exporter for a manual test tracking app using this -- render to (pretty simple) HTML, pass to the prince executable, and out comes a beautifully typeset PDF.
Prince has its own rendering engine that is purpose-built for PDF rendering. It's actually very good - a lot of professional books and documents have been typeset using Prince.

smt88#
We have been using PDF2XL[1] for this for years (used to be called CogniView).

It's genuinely unbelievable. If the PDF isn't sufficiently structured, it has OCR that seems to "just work".
You can also automate the extraction and integrate it into your pipeline.
The UI is pretty old and ugly-looking, but it is one of the few apps I've used in the last 10 years that made me feel genuine delight.
1. https://pdf2xl.com

burmanm1 reply#
Anything wrong with XSL-FO? I know it's not the hottest thing on earth, but it works. Apache FOP is still developed and it's easy to add it to a pipeline.
TimTheTinker#
It's a lot harder to work with than an HTML template and a CSS file.

Load more comments