Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- ...
- jQuery(document).ready(function($) {
- $('#printerButton').click(function(){
- openPrintDialogue();
- });
- });
- function openPrintDialogue(){
- $('<iframe>', {
- id: 'frame',
- scr: 'path/to/my/external/html/file',
- name: 'myiframe',
- class: 'printFrame'
- })
- .appendTo('body');
- window.frames['myiframe'].focus();
- window.frames['myiframe'].print();
- setTimeout(() => { $(".printFrame").remove(); }, 1000);
- };
- ...
- </script>
- <html>
- ...
- <input type="button" id="printerButton" name="print" value="Print It" />
- ...
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement