I am trying to print a doc file located in my server using a js function. At first, I thought it is going to an easy task, but after a lot of research I can not find a way to do that.
I have tried this, but the result is a page with the url in the content of it.
$('#printItems').on('click', '.toPrint', function(e){
console.log("Printing...");
e.preventDefault();
doc = $(this).attr( "href" );
var w = window.open(doc);
w.document.write(doc);
w.print();
});
Thanks in advance.
UPDATE:
I know that google doc has the option to do that. Does it convert the file to PDF and use pdf.js ?
I think there is no proper way to directly write in file using javascript. You can use other programming language like java,c. They providing direct access to create files and read/write them
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.