3

I'm using JSPDF to convert HTML to pdf and I want to send it over email. For that, I need to store the file in the folder. But I'm not able to store it on the folder as "jspdf.save('filename.pdf')" does not give option for path.

    var pdf = new jsPDF('p', 'pt', 'letter'),
    source = $("#printFavorites").html();
    specialElementHandlers = {
        // element with id of "bypass" - jQuery style selector
        '#bypassme': function (element, renderer) {
            // true = "handled elsewhere, bypass text extraction"
            return true
        }
    };
    margins = {
        top: 0,
        bottom: 0,
        left: 30,
        width: 522
    };

    pdf.fromHTML(
        source,
        margins.left,
        margins.top, {
            'width': margins.width,
            'elementHandlers': specialElementHandlers
        },
        function (dispose) {
            pdf.save('filename.pdf'); // Not able to attach path
        }, margins
    );

I want to store this file somewhere on the folder. Is there any way I can do this here?

Thanks

  • Possible duplicate of [Saving pdf on server side with jsPDF](https://stackoverflow.com/questions/42004002/saving-pdf-on-server-side-with-jspdf) – Desmond Aug 27 '17 at 19:13
  • Want to store file using client-side JS –  Aug 28 '17 at 14:19
  • Your only other option on the client side is [Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Storage). See also [File System API](https://developer.mozilla.org/en-US/docs/Web/API/FileSystem), but this is poorly supported across almost all major browsers. – Desmond Aug 28 '17 at 17:12
  • Yes on clientside its hard to use fs. –  Aug 29 '17 at 10:18

0 Answers0