Swizec Teller - a geek with a hatswizec.com

Senior Mindset Book

Get promoted, earn a bigger salary, work for top companies

Senior Engineer Mindset cover
Learn more

    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.

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

    Did you enjoy this article?

    Continue reading about The strange world of getting user data onto a piece of paper

    Semantically similar articles hand-picked by GPT-4

    Senior Mindset Book

    Get promoted, earn a bigger salary, work for top companies

    Learn more

    Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.

    Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.

    Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.

    Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev

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

    Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections

    Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog

    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 ❤️

    Created by Swizec with ❤️