none
Need a Sugestion RRS feed

  • Question

  •  I have developed a sharePoint App in which i have created a form using javascript css html..at submit button the data is saved in sharePoint list..in another app i have retrieved the inserted data of form from sharePoint list in DataTable ...I need a button in DataTable ..on click of that button the row data of DataTable should open in html form in pdf format


    • Edited by Nagma Khan Thursday, February 2, 2017 1:20 PM
    Thursday, February 2, 2017 1:16 PM

All replies

  • create pdf on the fly by using some API (check e.g. Best C# API to create PDF). Check also How to create PDF in ASP.NET.

    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

    Thursday, February 2, 2017 5:05 PM
  • Thank you for a reply..

    but i have to do this with Javascript or Jquery

    I have a DataTable..I have created Button on each row also

    now on that button I have to do code to fetch that row data in html form 

    Friday, February 3, 2017 5:42 AM
  • then check something like this: Generating PDFs from Web Pages on the Fly with jsPDF. But in provider hosted apps you may also use server side code, e.g. when app web site is running in Azure.

    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

    Friday, February 3, 2017 3:46 PM
  • glad to see your answer

    but question remains..onclick of the button the row data should be fetched in html form?


    NK

    Sunday, February 5, 2017 11:05 AM
  • not sure what exact difficulty you have. May be if you will show the code it will be more clear.

    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

    Monday, February 6, 2017 2:19 PM
  • $(document).ready(function () {
        load();
        var doc = new jsPDF();
        var specialElementHandlers = {
            '#editor': function (element, renderer) {
                return true;
            }
        };


        $('#tblEmirates tbody').on('click', 'tr', function () {

           var data = dataTable.row(this).data();
            alert(data);
            var AppliedEmiratesIdCard=(data[0]);
            var Date1 = (data[1]);
            var JobTitle=(data[2]);
            var FullName=(data[3]);
            var PoBoxNo =(data[4]);
            var PassportNo=(data[5]);
            var MotherName=(data[6]);
            var AddressInUAE=(data[7]);
            var EmployerSponsor=(data[8]);  
            var EducationStDegree=(data[9]);
            var MaritalStatus=(data[10]);
            var MobileNo=(data[11]);
            var Religion=(data[12]);
            var HomePhoneNo=(data[13]);

            var content = $("#divContent").html();

            content = content.replace("#Date#", Date1);
            content = content.replace("#Full Name#", FullName);
            content = content.replace("#Passport No#", PassportNo);
            content = content.replace("#Address in UAE#", AddressInUAE);
            content = content.replace("#Education Status/Degree#", EducationStDegree);
            content = content.replace("#Mobile No#", MobileNo);
            content = content.replace("#Home Phone Number in Country of Origin#", HomePhoneNo);
            content = content.replace("#Job Title#", JobTitle);
            content = content.replace("#PO Box No#", PoBoxNo);
            content = content.replace("#Mother's Name#", MotherName);
            content = content.replace("#Employer/Sponsor#",EmployerSponsor);
            content = content.replace("#Marital Status#", MaritalStatus);
            content = content.replace("#Religion#", Religion);

            $("#divContent").html(content);

            doc.fromHTML($('#divContent').html(), 15, 15, {
                'width': 170,
                'elementHandlers': specialElementHandlers
            });
            doc.save('sample-file.pdf');
        });

    } );

    this is  the code to get the data from DataTable and set it to the html form..

    requirement is almost done but in pdf format design of the div is not acceptable...

                               

    NK

    Wednesday, February 15, 2017 11:40 AM