Printing file on server using php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Printing file on server using php

How can i print a file that exists on server using my printer in php? EDIT I am sorry if i didn't state my question clearly. My question is that if i want to print something, how can i do it using PHP? Example: Assume that i have a website where people buy different products. When a person pays, i generate an invoice for that person. I want the person to be able to print his/her invoice. I want to provide the user an option to print his/her invoice. How can i do that in php?

2nd Dec 2018, 10:07 AM
Yousaf
Yousaf - avatar
3 Answers
+ 15
You need Javascript for this. Generate a page with an invoice with PHP and add a button which calls window.print(); Here's an example: https://www.w3schools.com/jsref/met_win_print.asp
9th Dec 2018, 4:10 AM
Igor Makarsky
Igor Makarsky - avatar
+ 13
Can you please clarify your question?
3rd Dec 2018, 9:54 PM
Igor Makarsky
Igor Makarsky - avatar
0
Edited my question
4th Dec 2018, 10:11 AM
Yousaf
Yousaf - avatar