简体   繁体   中英

Download SVG with image and patterns as PDF

I have a SVG with image and patterns applied on rects, how to download the whole thing as a PDF using javascript?

here is my code: http://jsfiddle.net/dnuboz21/5/

<div class="feature">
<svg style="height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;">
    <image width="980" height="600" xlink:href="http://en.hdyo.org/assets/art-shutter-young-people-a12e2c0cd7a54920cb024fd1394190fd.jpg" clip-path="url(#svg-mask)" />
    <defs>
        <pattern width="1" height="1" id="pat1" viewBox="325 110 150 150" preserveAspectRatio="xMidYMid slice">
            <image width="980" height="652" xlink:href="http://en.hdyo.org/assets/art-shutter-young-people-a12e2c0cd7a54920cb024fd1394190fd.jpg" style="filter:url(#svg-blur);" />
        </pattern>
        <filter id="svg-blur">
            <feGaussianBlur stdDeviation="10" />
        </filter>
    </defs>
    <rect x="325" y="110" rx="40" ry="40" width="150" height="150" style="fill:url('#pat1');stroke:red;stroke-width:5;" />
</svg>

You can't just download it as PDF. To create PDF you need a PDF tool like:

For more, search for example Google create pdf with browser

Another option would be to just print it. Many of today's browser has the option to print to PDF.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM