locked
Download CRM Forms as PDF RRS feed

  • Question

  • Hi, Recently I had been asked by a client that they require to download all CRM records in every entity in CRM as PDF.

    I tried with html2canvas and jspdf libraries , but i was not able to download the form completely.

    Please guide me if i am doing something wrong in the below code or there is any other way to do so.

    function createPDF() {
            var a4 = [595.28, 841.89];
                
                var div = $('#HeaderTilesWrapperLayoutElement', window.parent.document);
    
                var xxxx = $($(div.context).find('iframe')[0]).contents().find("body");
    
                var xxx = xxxx.find("#tdAreas");
                var cache_width = xxx.width();
               
                $('body').scrollTop(0);
                getCanvas().then(function (canvas) {
                    var
                     img = canvas.toDataURL("image/png"),
                     doc = new jsPDF({
                         unit: 'px',
                         format: 'a4'
                     });
                    doc.addImage(img, 'JPEG', 20, 20);
                    doc.save('techumber-html-to-pdf.pdf');
                     xxx.width((a4[0] * 1.33333) - 80).css('max-width', 'none');
                });
            }
    
            // create canvas object
            function getCanvas() {
                xxx.width((a4[0] * 1.33333) - 80).css('max-width', 'none');
                return html2canvas(xxx, {
                    imageTimeout: 2000,
                    removeContainer: true
                });
            }

    Thursday, December 15, 2016 7:51 PM

All replies

  • It really is a big ask by the client, there is software out there where you can mock up a form with no back or front end. Alternatively just use screen shots or grant the client read only access to the system front end for the short term.
    Friday, February 10, 2017 9:41 AM