web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Download CRM Form as PDF

(0) ShareShare
ReportReport
Posted on by 85

Hi, Recently I had been asked by a client that they require to download a complete CRM Form 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
            });
        }


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rahul-Waghmare Profile Picture
    990 on at

    Hi Mahesh,

    You can achieve this my creating SSRS report and download it as pdf. Please follow below link-

    www.c-sharpcorner.com/.../generate-pdf-file-using-javascript-in-microsoft-dynamics-crm-2015

    Regards,

    Rahul

  • Suggested answer
    Alagunellaikumar Profile Picture
    6,212 on at

    Hi

    Why don't you try the below the way?

    We can use ssrs report and download it as pdf from CRM form.

    You can also use document template.

  • Mahesh 1992 Profile Picture
    85 on at

    HI Rahul,

    Thanks for your reply, but client want to download each and every form in CRM , let us suppose i have around 1000 forms, if i go ahead and create ssrs reports for each and every one, then my whole development time will be gone in developing ssrs reports.

  • Mahesh 1992 Profile Picture
    85 on at

    Hi Aluge,

    Same goes for document templates too, i cant create document templates for each and every form. I need a generic solution.

    Thanks

  • Suggested answer
    Rahul-Waghmare Profile Picture
    990 on at

    Hi Mahesh,

    You need to create single SSRS Report for your entity by passing "RecordId" as parameter. Create a report in a such away that it will get all the field values of an entity based on your RecordId.

    Regards,

    Rahul.

  • Mahesh 1992 Profile Picture
    85 on at

    Hi Rahul,

    Problem is that I dont have to give this feature only for one entity, but all entities accross CRM.

    Thanks

  • Suggested answer
    Rahul-Waghmare Profile Picture
    990 on at

    Hi Mahesh,

    One more solution is,

    1. Create HTML web-resource, fetch all the fields based on record id.

    2. Create Ribbon Button "Download".

    3. Download PDF format from that HTML.

    For downloading use your method, rather than downloading from CRM form directly try to download from HTML Page then html2canvas and jspdf libraries will support.

    Regards,

    Rahul

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans