2

I am working in codeigniter, wherein I create one page and in that page create one table with print button. onclick that button, id and name should be sent on print.

how can I send that id and name on print without print preview?

1
  • 2
    You can't. The user will always have control over the print dialog box when using javascript. It's a security thing. Commented Apr 5, 2017 at 9:09

2 Answers 2

1

Simply put: you can't.

The farthest you can come with JavaScript and printing is window.print() which sends print command to the browser and opens the preview of the file you want to print.

If you could get past the preview, people would be able to send numerous print commands to your printer and print, for example, the complete Wikipedia website, which would consume a lot of paper.

Sign up to request clarification or add additional context in comments.

2 Comments

yes javascript printing window.print() but in that print only dynamic contact how send dynamic contants in that print()
Do you have a separate print css? Because you can hide stuff with css when you are printing a page!
0

Just think about the consequences. You visit my page and load the JS, and I execute print of 100000 pages. Does that seem like a thing that should exist? You can't use user's printer without him manually confirming what is being printed and pressing the print command himself.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.