hmsilveira Posted January 4, 2011 Share Posted January 4, 2011 Hi all, i'm wondering if i can print a document after i input one id in a text field. I need that when i input the field and push the send button, the system makes one query to the database and if the id exists i should print one word document and send it directly to the default printer. Do you think this is possible? Regards Hugo Quote Link to comment https://forums.phpfreaks.com/topic/223370-edit-document-and-print-it-automatically/ Share on other sites More sharing options...
denno020 Posted January 4, 2011 Share Posted January 4, 2011 You can use javascript to pop up the printer dialog, but then you would have to manually press print to confirm.. Other than that I'm not sure. Denno Quote Link to comment https://forums.phpfreaks.com/topic/223370-edit-document-and-print-it-automatically/#findComment-1154645 Share on other sites More sharing options...
hmsilveira Posted January 4, 2011 Author Share Posted January 4, 2011 Can you give me a short example how can i print with javascript? Quote Link to comment https://forums.phpfreaks.com/topic/223370-edit-document-and-print-it-automatically/#findComment-1154646 Share on other sites More sharing options...
denno020 Posted January 4, 2011 Share Posted January 4, 2011 it's really really really really easy lol: <body onLoad="window.print()"> That function doesn't need to be defined anywhere, I think it's like a stock standard function for browsers. When the page loads, it will print the page (which means bring up the print dialog and wait for confirmation. Denno Quote Link to comment https://forums.phpfreaks.com/topic/223370-edit-document-and-print-it-automatically/#findComment-1154650 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.