Live data from Hacker News

Laying Out a Print Book with CSS

iangmcdowell.com

101–110 of 121 posts

Re: Laying Out a Print Book with CSS

#101

Why not Scribus? It's FOSS, mature, and actively used for book layouts by others. It comes up in searches for "free InDesign alternative" and "foss book layout" (it's mentioned in every search result that I viewed [not many]). I mean, perhaps it didn't fit the story that showed the blog post to be used to trail the book, but I'd have thought it would be mentioned.

Do you have experience with it yourself? I haven't tried it for several years, but it was not at all usable last time I did. For a project like this, I think it's a good choice to go with something more declarative over a WYSIWYG tool. Latex would have been a very good choice, but only if you already happen to know it or have an interest in learning.

Yes, I've used it -- along with Inkscape and The GIMP -- for advertising [layout of flyers, for print magazine adverts].

Probably about 3 years since I used it last for this type of work.

I follow one of their support groups and people mention they publish newsletters, pamphlets, and books with it.

Re: Laying Out a Print Book with CSS

#102
post #10

Earlier quoted context omitted.

Yeah. I was going to echo this sentiment but it looks like you pre emptively followed me. The article has the air of a hack done just for the fun of it because the author can. This was popular once upon a time but these days, it's mostly stuff written to promote certain things or as marketing copy.

This is marketing, don’t kid yourself.

Author here: I'd like to think it's a little bit of both, but mostly "here's a silly hack." I tried to separate the marketing from the content as cleanly and honestly as possible.

I'll give you a peek inside my head, and you can decide if you trust me to be telling the truth.

I did this silly hack because I wanted to hold a copy of my book. I knew it was crazy when I was doing it, and that there were simpler/better ways of accomplishing the same goal. But I was surprised that (1) it worked at all, and (2) it came out as well as it did – though you can certainly find people in the comments here who can identify the flaws.

I did not do this silly hack because I wanted to use it to write a marketing post. That would be an extraordinarily convoluted way of going about things, even for me.

Anyhow, I like writing, and I like sharing my writing, so I put together this post about something I did that I found interesting. I don't expect everyone to enjoy it, but it seems like some people found it entertaining and/or learned a little bit about CSS.

And yes, I included two links to my book. Given that the existence of the book is central to my motivation to pursue the project, it would be silly not to at least mention it. So I did, one link at the top where I think it's relevant context, and an actual "pitch" at the bottom, separated from the other content/called out explicitly so anyone allergic to marketing could bail. I'm not being snarky; I personally dislike marketing and hate most of the ways it's done.

And even still, I do feel conflicted. I grew up in the 90s, and I miss that old, pre-commerce internet populated by hobbyists. Maybe I should have left the pitch out.

Re: Laying Out a Print Book with CSS

#103

Earlier quoted context omitted.

Yup. Well written enough for me to forget that part. Just enjoyed the post .

The question then is, is it effective marketing? How many sales resulted from this blog post? Zero? A handful? Tens? Hundreds? I would guess a handful at most. And I am not saying that to criticise the author. Marketing is genuinely difficult. Hell I even did a marketing campaign with paid ads on Reddit to get more people to use one of my pieces of open source, free of charge, pieces of software and even with a bunch…

I'll answer the question: a handful at most

7 ebooks ordered as of 10:15 PST, and 10 subscribers for the free novella.

I have no idea how many people read the post, I assume lots? I'm hosting on Github pages and haven't added any tracking. It seems like anecdotally a front-page post gets ~20k views, so some tiny fraction of a percent of readers went on to purchase.

Honestly, this small number of sales is still far more than I was expecting. I wrote a longer response on my motivations higher in the thread, but my primary impulse was sharing, not marketing. I tacked a marketing pitch at the end, figuring I might as well, but I did not expect the post to spend any time at all on the front page of HN.

It is also probably true that this "marketing" was worse than ineffective, it was likely detrimental. I'm guessing that substantially more people clicked through to Amazon to see what the book was, despite being a poorly targeted audience that is unlikely to convert. From Amazon's point of view, the book just got a ton of traffic and very few sales, which is probably treated as the signal "this book is not a good seller, don't show it to people."

Similarly, the members of this poorly targeted audience that did buy the book are unlikely to be typical readers in the genre. This will degrade the "also bought" signal for the book, and to the extent that Amazon does organically show my book to other readers, it will likely show it to the wrong readers, further hurting organic performance.

Re: Laying Out a Print Book with CSS

#104
post #6

If the objective was not spend on design software, why not use latex?

The objective was to get a print book while minimizing time and money spent. I happen to have a lot of experience with CSS, which is why I reached for the tool. I've never used latex, but the impression I have of it is that there's a big learning curve and it would take me many hours to produce output I was satisfied with. OTOH, it would add another useful skill in my toolbox.

Re: Laying Out a Print Book with CSS

#105
post #103

Earlier quoted context omitted.

The question then is, is it effective marketing? How many sales resulted from this blog post? Zero? A handful? Tens? Hundreds? I would guess a handful at most. And I am not saying that to criticise the author. Marketing is genuinely difficult. Hell I even did a marketing campaign with paid ads on Reddit to get more people to use one of my pieces of open source, free of charge, pieces of software and even with a bunch…

I'll answer the question: a handful at most 7 ebooks ordered as of 10:15 PST, and 10 subscribers for the free novella. I have no idea how many people read the post, I assume lots? I'm hosting on Github pages and haven't added any tracking. It seems like anecdotally a front-page post gets ~20k views, so some tiny fraction of a percent of readers went on to purchase. Honestly, this small number of sales is still far mo…

>Similarly, the members of this poorly targeted audience that did buy the book are unlikely to be typical readers in the genre.

I would assume they were typical readers in the genre, which obviously some percentage of readers from HN would have to be.

A post of mine on criticism https://news.ycombinator.com/item?id=32392070 went to front page for a bit and got 4.7K hits according to medium.

I would think if Amazon has any sort of decent traffic analysis ranking it would have the understanding of unknown/random spikes and discount negative data from that as noise (unless it led to a bunch of negative reviews etc. in that spike) but maybe I'm just too hopeful about stuff.

Wish I could sell some books though but as I don't ever it seems unlikely I know what I'm talking about anyway. :)

Re: Laying Out a Print Book with CSS

#106
post #24

For those interested in this topic, you might want to checked paged.js https://pagedjs.org/documentation/ It's an polyfil for the unimplemented CSS paged specification, which is exactly that is needed for laying out pages. https://www.w3.org/TR/css-page-3/

If I wanted to write a book, how does this translate to the publisher's standards when it comes time to hand in the design? Do publishers accept css files? How does that whole publishing pipeline work with this css framework?

Publishers (traditional ones like Random House, HarperCollins) would take a Microsoft Word document manuscript. Each publisher has guidelines for their manuscript.

They will handle the typesetting themselves.

You need to do it all only if you are self-publishing.

Re: Laying Out a Print Book with CSS

#107
post #102
post #10

Earlier quoted context omitted.

This is marketing, don’t kid yourself.

Author here: I'd like to think it's a little bit of both, but mostly "here's a silly hack." I tried to separate the marketing from the content as cleanly and honestly as possible. I'll give you a peek inside my head, and you can decide if you trust me to be telling the truth. I did this silly hack because I wanted to hold a copy of my book. I knew it was crazy when I was doing it, and that there were simpler/better w…

I'm not condemning your actions, just pointing out naivety. Some of those most influenced by marketing are those who think they are above it all.

Re: Laying Out a Print Book with CSS

#109
post #64

The author is actually underselling CSS for rendering PDF layouts. Of course, if you just do a static book, you are probably better off with software like InDesign. But if you need PDFs with dynamic and complex content (e.g. info documents with graphs, tables, dynamic text) then HTML/CSS is actually pretty great. As he mentions, unfortunately the CSS3 Paged Media spec is not very well-supported by major browsers, tho…

The table thing is so true. I was insistent on using LaTeX in school and on lab reports I actually ended up building a web-based tool that would convert xlsx files into LaTeX tables I could easily embed with my data. It was pretty janky but worked well enough to save me some time. I haven't much if anything to it since about 2011 and it still sees a decent amount of traffic which tells me there's still not great solutions to the problem!

Re: Laying Out a Print Book with CSS

#110
post #96

Earlier quoted context omitted.

At the moment, the combo of pagedjs with a headless browser is my first recommendation when you need something to output pdf automatically. Weasyprint looks nice, I have yet to use it. It probably has the advantage of not using an actual browser document (with all the relayouting problems), and may use fewer resources in terms of time and memory (I'd have to check though). The disadvantage is also it's not an actual…

> meaning you need to render the html and css in some form before passing it to weasyprint I'm not sure I understand this part. WeasyPrint is a rendering engine; it takes an HTML file as input and outputs a PDF. I can't speak to resource usage, since this was very ad-hoc. For my needs, it was very simple to set up, and worked on the first try. I was testing with about five pages of content, and on my M1 MBP it render…

With "render" I meant you need to first create the html and css before handing it over to weasyprint. You can't use browser-based chart libraries unless you convert their output to svg or other image formats first.

With a headless browser you can use for example react to generate the document, you can just insert any chart library and so on.

And regarding resource usage I had scenarios of "pdf as a service" in mind, where you need to generate pdfs dynamically. Reporting, invoices, what have you.

Post reply on HN