Using SVG to make custom paper (and why it didn’t work)

I’ve been wanting some specific pages of paper for the paper pad I use at work. I’ll plug the specifics features and brand I love below because I think it’s really cool, but let’s stick to the programming for the moment.

Anyway, there are lots of websites out there that will let you download many different configurations of “graph paper” for you to print out on your own printer. That seemed like what I wanted but site after site that I went to had only a big (or small) tub of PDF files from which you could pick. Sometimes they printed out well, most often not, and they really didn’t have the setups I was interested in trying (something like Cornell Notes but with different things in different areas, like dots or a blank area sometimes instead of lines).

So I had the clever idea that I would put together a simple one page website where you could pick from a few simple blocked out versions of a page (for different sizes of paper like US letter and A4 or portrait vs. landscape layout) and then put any of several different patterns in each area. Then I would generate the page using SVG in the browser and you could print out the paper and even bookmark your creation so you could come back and print it as often as you like. Sheer genius!

Except for one thing, even in 2013 when lots of browsers are claiming to have good SVG support, they kind of forgot to support printing and SVG… So you get results that look great in-browser with Chrome or Firefox and you can zoom in four or more times and still see sharp vector drawn shapes. Print out that same thing and you’ll just get a fuzzy mess, even if you choose PDF as the output target where logically the vector shapes should have just been sent straight into the PDF and zoom just as nicely as they did on screen.

Here’s an example of a dot grid that I wanted to print out to the page:

It looks a little aliased on-screen on Chrome but that didn't bother me, I don't have a Retina display on my Mac so I expected it to be a little rough at anything other than print resolution.

It looks a little aliased on-screen on Chrome but that didn’t bother me, I don’t have a Retina display on my Mac so I expected it to be a little rough at anything other than print resolution.

Here’s the same SVG dot paper zoomed in 400% on Chrome. Yup, I did it correctly. All those dots are little circles spaced out just like I wanted.

Zoomed in everything looks good! Let's print it!

Zoomed in everything looks good! Let’s print it!

Then, sadly, in my experience it matters not whether you’re printing to a real printer or to PDF, the following is typical of what actually comes out for this (zoomed in so you can see all the wonderful detail):

Wow! That's exactly nothing like what I drew. Thanks Chrome, thanks Firefox!

Wow! That’s exactly nothing like what I drew. Thanks Chrome, thanks Firefox!

I didn’t have the heart to try it in IE, I figured it would just be straight up blasphemy. And it wouldn’t matter anyway, because even if IE worked perfectly, any solution that wouldn’t work in Chrome and Firefox would be next to useless because those two browsers represent more than half (and by some estimates right around 66%) of all browsers being used today.

Oh, I did promise a plug for the nifty paper pad I use. If you’re in the United States then the Staples chain of office supply stores has a neat line of pads and paper called Arc. It’s almost identical to the Circa notebooks that Levenger carries except much less expensive. In both cases the spine of the notebooks have a set of small plastic disks onto which specially punched paper is pressed. Just the cross-section shape of the rings and the way the paper is punched is sufficient to keep the pages in place, but should you choose you can easily remove pages, add pages, or rearrange pages without the finickiness of ring binders. I love mine and I bought the special punch that Staples sells so I can use whatever paper I like in my notebook. As a result it’s a mix of blank pages, lined pages, pages for laying out iPhone apps, and even notes I printed out from Evernote. Thus my desire to generate all new forms of paper ideally suited to how I take notes and for noodling on new ideas.

Despite my inability to make this work with SVG, I’m not giving up. I’ll just have to think for a while and return to the problem. Necessity is still the mother of invention and I still need pages I can’t get on any of the downloadable paper sites I’ve been to yet.

Advertisements

4 thoughts on “Using SVG to make custom paper (and why it didn’t work)

  1. Donny

    Great concept 🙂 !

    Have you tried looking into rasterizing the SVG to canvas in print resolution ? E.g., most printing requires atleast 300dpi. So, for an A4 it is around 2480 X 3508 px.

    I think this should work, staying tuned for progress !

    Reply
    1. John Munsch Post author

      That was exactly what I tried next but in my experience it doesn’t work. However, since then I think I’ve had a breakthrough.

      So, I tried making a huge SVG and then printing that, but the browsers all thought I wanted it to print at that size so they tried to print a mosaic of pages (or just clip it) for the huge element. Then I tried using the HTML5 canvas to do the same thing and when it didn’t work any better, I investigated people complaining about poor print quality on their canvas work and found that you can make a huge canvas and _then render it to an image inside the browser_!!

      The image can be assigned to another element over which you control the size. So finally you can have something which has higher resolution than its displayed size. I believe by doing this I can render the canvas at a huge size (like you suggested), pull out its image, and size it to the width of the page to get what I want. I’m going to return to in a week or so (as soon as my MongoDB course is done) to see if I’m right.

      Reply
    1. John Munsch Post author

      I hadn’t tried it in Safari. It’s cool that it works, but I was actually going to turn this into a simple one page website and monetize it with some Google ads to make a few bucks. So I really need a solution which will work for the majority of those likely to visit (that is, Chrome and Firefox on Windows and Mac), anything beyond that is great but I don’t feel I can put it up unless at least 2/3rds of people can use it.

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s