MrRio/jsPDF — pull request #397 by bpmckee (2014-11-22 06:08:31+00:00)
Title: Fixing addHTML crop math so PDFs are not blurry.  Fixes issue #339

If you used addHTML with the pagesplit option enabled, you likely had blurry images / text. There were a couple issues happening.

1st, in the previous line 1863 ```var args = [canvas, x,cy?0:y,canvas.width/K,canvas.height/K, format,null,'SLOW']``` it was passing a recently created canvas to ```addImage()```. addImage can take either a canvas or an image. addHTML takes in an object that can be either as well. If it is an image, it calls the ```crop()``` method. If it is a canvas, it creates an image from the canvas an then calls ```crop()```. Basically you're either going Image -> canvas -> Image, or canvas -> Image -> Canvas -> Image depending on what was passed into addHTML(). Having the canvas draw the image again was reducing the image quality slightly.

2nd, the math to crop the image was slightly off. Unless your browser width was just right, the image would either be squished or stretched. This made a significant "blurry image" look especially with text.

The code I modified now does not need the extra canvas -> image step to crop the image for each page. It also fixes the math so that the image is never squished or stretched.

The issue that I opened awhile ago is #339
Sorry it took me so long getting around to submitting a pull request :)