Is there a way to not open a new tab when printing?

Is there a way to not open a new tab when printing?

FRS4002FRS4002 Posts: 85Questions: 11Answers: 0
edited August 2022 in Free community support

I need when I click on print button, not to open a new tab when printing... Is there a way of doing this? I did check on this solution on this link https://datatables.net/forums/discussion/45126/buttons-print-chrome-problem
It is working pretty well, but this solution, prevented me from adding messageTop and photo... messageTop and adding a photo won't work. Is there a better solution other than this solution?

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    No - sorry. The print feature works by creating an entirely new HTML document with just the table in it. As a result we need to display it in a new tab, otherwise we'd be overwriting the original document.

    I did, way back in the day, use to put a wrapper around all the content of the document, hide the wrapper and then put the table in. But it caused so many problems... CSS styling going haywire, Javascript events being removed, etc.

    I think the only way to reliably add a photo would be to use a base64 string as a source for the image.

    Allan

Sign In or Register to comment.