Skip to content
Swizec Teller - a geek with a hatswizec.com

The strange world of getting user data onto a piece of paper

When was the last time you tried to put something digital onto a piece of paper?

It's not very difficult right? As it shouldn't be, we live in the future! Take a document, click print and voila, the magical elves in a plastic box do their magic and you get a lovely piece of paper with some crap on it.

trollface

If you don't have a box of elves of your own, you take it to the nearest person who does, pay them the price of a tenth of gum and they do it for you.

But sometimes you want to do this in a more sophisticated manner. Perhaps your target paper size isn't A4, perhaps you're doing something that can't just be whisked up in your favourite Word clone. Maybe, just maybe, you aren't producing the content, maybe you have a form somewhere on the interwebs that people can fill out.

As I found out last night and this morning, that bit isn't too simple.

Last night I set out on the monumental task of preparing the second batch of Postme.me's for printing. I was once told that everybody in the world uses something called InDesign to do this, hell, I used it to set up the first batch.

But it was 18 cards this time, that's a bit much to do by hand isn't it? I'm a lazy programmer after all and my kind cowers before menial tasks like nobody's business!

I will automate this!, I thought.

The fuck I will.

After spending five minutes getting the database to export as a shiny XML I spent upwards of two hours trying to figure out how to convince InDesign to import said XML. Yes, it does haz the capabilities, no they don't help ... or maybe I just can't think like a designer and that's why nothing made sense.

I mean come on, you tag all the fields, you get all the data to import and be properly tagged ... but it just does not want to fill the template. It could at least help with the menial tasks. Nope, Fuck you! I will reset all your fonts and colours to a magical default. Problem?

InDesign was trolling me on purpose, I swear!

Oh but what's this, browsers have a shiny print to PDF feature don't they? Maybe I can just export as nice HTML and get a browser to print it into a PDF and be done with it.

Yeah, fuck that too. Turns out no matter how hard I tried it is virtually impossible to convince any browser to print without margins. Even setting up a custom paper size that explicitly defines zero margins ... nope. The closest browser to come to cracking the problem was Chromium on Linux ... things only got screwy around page 15 ... and only got worse henceforth.

Chromium on Mac indeed has an actual working marginless feature. But it only supports A4 directly, use the OS's print screen and the marginless feature magically vanishes, but you do get different paper sizes.

And it only gets worse.

Tried a number of different programs and libraries to export a piece of nicely formatted modern-ish HTML to PDF and nothing worked. Either the paper sizes were off (but the margins were alright) or the font didn't render correctly.

In the end, after at least five hours of trying different things, I broke down and did it by hand. Copy pasted all the images and all the text into an InDesign file ...

... it took 20 minutes.

Hat's off to all the designers of the world who do this stuff on a daily basis.

Enhanced by Zemanta

Did you enjoy this article?

Published on October 24th, 2011 in Data Formats, Google Docs, Internet meme, Linux, Uncategorized

Learned something new?
Want to become a high value JavaScript expert?

Here's how it works 👇

Leave your email and I'll send you an Interactive Modern JavaScript Cheatsheet 📖right away. After that you'll get thoughtfully written emails every week about React, JavaScript, and your career. Lessons learned over my 20 years in the industry working with companies ranging from tiny startups to Fortune5 behemoths.

Start with an interactive cheatsheet 📖

Then get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career.

"Man, love your simple writing! Yours is the only email I open from marketers and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"

~ Ashish Kumar

Join over 10,000 engineers just like you already improving their careers with my letters, workshops, courses, and talks. ✌️

Have a burning question that you think I can answer? I don't have all of the answers, but I have some! Hit me up on twitter or book a 30min ama for in-depth help.

Ready to Stop copy pasting D3 examples and create data visualizations of your own?  Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization

Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.

Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev

Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️