Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to print a pdf

// use Print.JS
// npm install print-js
$http({      // get request for print pdf
    url: "",
    method: "GET",
    headers: {
        "Content-type": "application/pdf"
    },
    responseType: "arraybuffer"
}).success(function (data, status, headers, config) { // if no error occurs
    var pdfFile = new Blob([data], {
        type: "application/pdf"
    });
    var pdfUrl = URL.createObjectURL(pdfFile); // create pdf url
    //window.open(pdfUrl);
    printJS(pdfUrl); // call Print.JS funtion to print the pdf 
    //var printwWindow = $window.open(pdfUrl);
    //printwWindow.print();
}).error(function (data, status, headers, config) {
    alert("Sorry, something went wrong")
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript regex exact match 
Javascript :: index of row jquery 
Javascript :: js fetch queryselector 
Javascript :: expect any function jest 
Javascript :: react youtube npm 
Javascript :: javascript empty function 
Javascript :: react styled functional component 
Javascript :: js comparison operators 
Javascript :: javascript character ascii value modify 
Javascript :: nodejs watermark image 
Javascript :: how to tell what page you are on shopify liquid 
Javascript :: javascript mod 
Javascript :: nuxt 3 add plugin 
Javascript :: react native navigation shared element 
Javascript :: find highest number in array javascript 
Javascript :: How to initialize select2 dynamically 
Javascript :: copy element jquery 
Javascript :: angular 9 radio button checked 
Javascript :: javscript match word in string 
Javascript :: math.max js 
Javascript :: google script check if cell is empty 
Javascript :: how to get parameter from url in react js 
Javascript :: electron get printer list 
Javascript :: javascript do while 
Javascript :: inbuilt javascript functions for last word check 
Javascript :: js map size 
Javascript :: react router how to send data 
Javascript :: disable long press on chrome 
Javascript :: javascript download html to pdf 
Javascript :: base 2 number javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =