Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How include title in pdf exported #6284

Closed
diegofazio opened this issue Jul 25, 2022 · 2 comments
Closed

How include title in pdf exported #6284

diegofazio opened this issue Jul 25, 2022 · 2 comments
Labels
export Issues for the export extension. help-wanted Issues we need or would love help from the community to resolve.

Comments

@diegofazio
Copy link

Description

Hi, I've tried to add a simple title to pdf exported. But I couldn't do it.

This are my libs
bootstrap-table-export.min.js -> v1.20.2
jspdf.umd.min.js -> v2.5.1
jspdf.plugin.autotable.js -> 3.5.25
tableExport.min.js -> 1.26.0

Thanks!
Diego.

Example(s)

$("#table").bootstrapTable({   
    exportOptions: {
        fileName: 'export_anim',
        jspdf: {
            orientation: "l",
            autotable: {
                margin: {top: 80},
                beforePageContent: function (data) {
                    var doc = data.doc; // Internal jspdf instance
                    doc.setFontSize(20);
                    doc.setTextColor(40);
                    doc.setFontStyle('normal');
                    doc.text("Table Title", data.settings.margin.left, 60);
                }
            }
        }
    }
});

And I get this

Uncaught TypeError: Cannot read properties of undefined (reading 'setFontSize')
    at Object.beforePageContent (fresven1:243:32)
    at jsPdfAutoTable (tableExport.min.js:13:63047)
    at HTMLTableElement.<anonymous> (tableExport.min.js:13:34588)
    at Function.each (jquery-3.3.1.min.js:2:2573)
    at w.fn.init.each (jquery-3.3.1.min.js:2:1240)
    at tableExport.min.js:13:28704
    at done (tableExport.min.js:13:42633)
    at loadImages (tableExport.min.js:13:43584)
    at $.fn.tableExport (tableExport.min.js:13:28620)
    at u (bootstrap-table-export.min.js:10:32422)
@diegofazio diegofazio added the help-wanted Issues we need or would love help from the community to resolve. label Jul 25, 2022
@UtechtDustin
Copy link
Collaborator

Sorry but we can't help here, you try to set options for the autotable plugin for the export plugin.
But it seems this is since 2017 broken, please check [this issue] (hhurz/tableExport.jquery.plugin#141).

@UtechtDustin UtechtDustin added the export Issues for the export extension. label Jul 29, 2022
@davidbarman
Copy link

Were you able to find a method to add a title to the PDF? I am looking for the same functionality.
Also, in my case I have some column data this is being cut off. I would like it to wrap to the next line like it does onscreen.

If you have any ideas, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
export Issues for the export extension. help-wanted Issues we need or would love help from the community to resolve.
Projects
None yet
Development

No branches or pull requests

3 participants