Re: Printing only SVG in Web Page

Bjoern Hoehrmann <[email protected]> Fri, 13 Dec 2013 03:25:11 +0100
Newsgroups gmane.text.xml.svg.devel
Message-ID <[email protected]>
* <[email protected]> wrote:
>About a year ago I needed to print  the visible/dynamic svg in my web 
>page. It was a hack. but it worked. However, because of HTML5 and canvas 
>with jQuery is it is now sweet...So I would like to share.(IE/Chrome/FF)

> var printSVG = function() {
>  var popUpAndPrint = function()
>  {
>   dataUrl = [];
>     $('#printCanvas').filter(function() {
>      dataUrl.push(this.toDataURL("image/png"));
>    })

>    var printWindow = window.open('', 'PrintMap',
>      'width=' + width + ',height=' + height);
>    printWindow.document.writeln($(container).html());
>    printWindow.document.close();
>    printWindow.focus();

Are you sure it wouldn't be easier to simply clone the `<svg>` into the
new document? Conversion to a low resolution bitmap graphic is also
likely to result in inferior printing quality.
-- 
Björn Höhrmann · mailto:[email protected] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/