locked
Shiledui container data in PDF RRS feed

  • Question

  • User639567535 posted

    HI 

    I successfully export data to PDF though this

    <script type="text/javascript">
            jQuery(function ($) {
                $("#pdf").click(function () {
                    // parse the HTML table element having an id=exportTable
                    var dataSource = shield.DataSource.create({
                        data: "#tabledata",
                        schema: {
                            type: "table",
                            fields: {
                                ID: { type: String },
                                Owner: { type: String },
                                RegNo: { type: String }
                               
                            }
                        }
                    });
    
                    // when parsing is done, export the data to PDF
                    dataSource.read().then(function (data) {
                        var pdf = new shield.exp.PDFDocument({
                            author: "PrepBootstrap",
                            created: new Date()
                        });
    
                        pdf.addPage("a4", "portrait");
    
                        pdf.table(
                            50,
                            50,
                            data,
                            [
                                { field: "ID", title: "ID", width: 70 },
                                { field: "Owner", title: "Owner", width: 100 },
                                { field: "RegNo", title: "RegNo", width: 70 }
                              
                            ],
                            {
                                margins: {
                                    top: 50,
                                    left: 50
                                }
                            }
                        );
    
                        pdf.saveAs({
                            fileName: "PrepBootstrapPDF"
                        });
                    });
                });
            });
    </script>

    Now i have div 

    <div id="container">
      </div>

    in that div there is high chart data i.e. Pie chart now i want also this in PDF i.e. html data also populated in PDF now with this in same PDF file i also want that chart 

    how i do this 

    Monday, August 8, 2016 8:18 AM

Answers

  • User61956409 posted

    Hi Bakhtawar Ashiq,

    What chart control or plugin you are using now? And according to your code, it seems that a datasource should be created based on a html table before you export data to pdf. So please check the html source of the container <div> to make sure if pie chart is rendered as html table structure.

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 9, 2016 10:58 AM

All replies

  • User61956409 posted

    Hi Bakhtawar Ashiq,

    What chart control or plugin you are using now? And according to your code, it seems that a datasource should be created based on a html table before you export data to pdf. So please check the html source of the container <div> to make sure if pie chart is rendered as html table structure.

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 9, 2016 10:58 AM
  • User639567535 posted

    no . div render as div not like html structure 

    Tuesday, August 9, 2016 11:05 AM
  • User61956409 posted

    Hi Bakhtawar Ashiq,

    It seems that the jQuery tableExport Plugin just enable us to export html table, please make sure if you provide a html table to tableExport Plugin.

    Best Regards,

    Fei Han

    Wednesday, August 17, 2016 4:35 AM