Search code examples
jqueryhtmlcssangularjsprintthis

Don't want to show print preview popup using printThis library


I am adding a jquery plugin printThis in my project. on clicking the print button it first shows the print preview and when we click on save than only it saves the pdf. But I don't want to show that popup. It should directly save the pdf without showing the popup

You can check on the link http://jsfiddle.net/jasonday/Tx4Uv/12/

$("#printKitten").click(function() {
    $("#print").printThis({
        debug: true
    });
});

here it first shows the preview and than save the file


Solution

  • I'm the author of printThis.

    Two issues:

    • debug:true shows the iframe for printing. This is for debugging only and should not be set to true at any other time
    • You can't override the browser's print preview. If you need to trigger an automatic download for a pdf, printThis is not the right library for your needs.