How to send hidden information to printer to print












1















I need to print a Secret(Security) page contain "username" and "password" of user login information with JavaScript on the browser.



I do not want the contents of this page to be visible for user creator, When user click on Print button, Just i want to send data to printer as hidden, I mean user just see username and password values on A4 paper and no on the print preview on browser.



Thanks










share|improve this question




















  • 1





    I don't believe you can change preview with javascript in browser. Preview should be exactly the same as final result, so I know what I'm printing.

    – apple apple
    Jan 1 at 7:55








  • 1





    and what's the reason to do this? it just make no sense to me.

    – apple apple
    Jan 1 at 7:58






  • 1





    Just so you know, hidden elements are still visible in the source of the html page. The hidden value just tells the browser not to render the elements. They are therefore not very secret.

    – Joseph_J
    Jan 1 at 7:58






  • 1





    You can write a css script specifically for printing. You can create a css class for elements that are hidden and change them so they are not.

    – Joseph_J
    Jan 1 at 8:02






  • 1





    I believe disabling the "Print Preview" would be a browser specific setting, i.e. a CLI flag set to disable print preview. I've done this for kiosk software I've designed. There's just no way to do it from JS within a browser due to the nature of the way browsers sandbox your code.

    – Drew Reese
    Jan 1 at 8:03


















1















I need to print a Secret(Security) page contain "username" and "password" of user login information with JavaScript on the browser.



I do not want the contents of this page to be visible for user creator, When user click on Print button, Just i want to send data to printer as hidden, I mean user just see username and password values on A4 paper and no on the print preview on browser.



Thanks










share|improve this question




















  • 1





    I don't believe you can change preview with javascript in browser. Preview should be exactly the same as final result, so I know what I'm printing.

    – apple apple
    Jan 1 at 7:55








  • 1





    and what's the reason to do this? it just make no sense to me.

    – apple apple
    Jan 1 at 7:58






  • 1





    Just so you know, hidden elements are still visible in the source of the html page. The hidden value just tells the browser not to render the elements. They are therefore not very secret.

    – Joseph_J
    Jan 1 at 7:58






  • 1





    You can write a css script specifically for printing. You can create a css class for elements that are hidden and change them so they are not.

    – Joseph_J
    Jan 1 at 8:02






  • 1





    I believe disabling the "Print Preview" would be a browser specific setting, i.e. a CLI flag set to disable print preview. I've done this for kiosk software I've designed. There's just no way to do it from JS within a browser due to the nature of the way browsers sandbox your code.

    – Drew Reese
    Jan 1 at 8:03
















1












1








1








I need to print a Secret(Security) page contain "username" and "password" of user login information with JavaScript on the browser.



I do not want the contents of this page to be visible for user creator, When user click on Print button, Just i want to send data to printer as hidden, I mean user just see username and password values on A4 paper and no on the print preview on browser.



Thanks










share|improve this question
















I need to print a Secret(Security) page contain "username" and "password" of user login information with JavaScript on the browser.



I do not want the contents of this page to be visible for user creator, When user click on Print button, Just i want to send data to printer as hidden, I mean user just see username and password values on A4 paper and no on the print preview on browser.



Thanks







javascript php css browser printing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 8:00







Sajjad Dehghani

















asked Jan 1 at 7:49









Sajjad DehghaniSajjad Dehghani

445514




445514








  • 1





    I don't believe you can change preview with javascript in browser. Preview should be exactly the same as final result, so I know what I'm printing.

    – apple apple
    Jan 1 at 7:55








  • 1





    and what's the reason to do this? it just make no sense to me.

    – apple apple
    Jan 1 at 7:58






  • 1





    Just so you know, hidden elements are still visible in the source of the html page. The hidden value just tells the browser not to render the elements. They are therefore not very secret.

    – Joseph_J
    Jan 1 at 7:58






  • 1





    You can write a css script specifically for printing. You can create a css class for elements that are hidden and change them so they are not.

    – Joseph_J
    Jan 1 at 8:02






  • 1





    I believe disabling the "Print Preview" would be a browser specific setting, i.e. a CLI flag set to disable print preview. I've done this for kiosk software I've designed. There's just no way to do it from JS within a browser due to the nature of the way browsers sandbox your code.

    – Drew Reese
    Jan 1 at 8:03
















  • 1





    I don't believe you can change preview with javascript in browser. Preview should be exactly the same as final result, so I know what I'm printing.

    – apple apple
    Jan 1 at 7:55








  • 1





    and what's the reason to do this? it just make no sense to me.

    – apple apple
    Jan 1 at 7:58






  • 1





    Just so you know, hidden elements are still visible in the source of the html page. The hidden value just tells the browser not to render the elements. They are therefore not very secret.

    – Joseph_J
    Jan 1 at 7:58






  • 1





    You can write a css script specifically for printing. You can create a css class for elements that are hidden and change them so they are not.

    – Joseph_J
    Jan 1 at 8:02






  • 1





    I believe disabling the "Print Preview" would be a browser specific setting, i.e. a CLI flag set to disable print preview. I've done this for kiosk software I've designed. There's just no way to do it from JS within a browser due to the nature of the way browsers sandbox your code.

    – Drew Reese
    Jan 1 at 8:03










1




1





I don't believe you can change preview with javascript in browser. Preview should be exactly the same as final result, so I know what I'm printing.

– apple apple
Jan 1 at 7:55







I don't believe you can change preview with javascript in browser. Preview should be exactly the same as final result, so I know what I'm printing.

– apple apple
Jan 1 at 7:55






1




1





and what's the reason to do this? it just make no sense to me.

– apple apple
Jan 1 at 7:58





and what's the reason to do this? it just make no sense to me.

– apple apple
Jan 1 at 7:58




1




1





Just so you know, hidden elements are still visible in the source of the html page. The hidden value just tells the browser not to render the elements. They are therefore not very secret.

– Joseph_J
Jan 1 at 7:58





Just so you know, hidden elements are still visible in the source of the html page. The hidden value just tells the browser not to render the elements. They are therefore not very secret.

– Joseph_J
Jan 1 at 7:58




1




1





You can write a css script specifically for printing. You can create a css class for elements that are hidden and change them so they are not.

– Joseph_J
Jan 1 at 8:02





You can write a css script specifically for printing. You can create a css class for elements that are hidden and change them so they are not.

– Joseph_J
Jan 1 at 8:02




1




1





I believe disabling the "Print Preview" would be a browser specific setting, i.e. a CLI flag set to disable print preview. I've done this for kiosk software I've designed. There's just no way to do it from JS within a browser due to the nature of the way browsers sandbox your code.

– Drew Reese
Jan 1 at 8:03







I believe disabling the "Print Preview" would be a browser specific setting, i.e. a CLI flag set to disable print preview. I've done this for kiosk software I've designed. There's just no way to do it from JS within a browser due to the nature of the way browsers sandbox your code.

– Drew Reese
Jan 1 at 8:03














1 Answer
1






active

oldest

votes


















1














Best you can do in-browser without being able to disable a Print Preview you can achieve it via CSS media queries, the @media screen should be hidden, and @media print should not.






share|improve this answer
























  • OK, Thank you dear.

    – Sajjad Dehghani
    Jan 1 at 9:01













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993869%2fhow-to-send-hidden-information-to-printer-to-print%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Best you can do in-browser without being able to disable a Print Preview you can achieve it via CSS media queries, the @media screen should be hidden, and @media print should not.






share|improve this answer
























  • OK, Thank you dear.

    – Sajjad Dehghani
    Jan 1 at 9:01


















1














Best you can do in-browser without being able to disable a Print Preview you can achieve it via CSS media queries, the @media screen should be hidden, and @media print should not.






share|improve this answer
























  • OK, Thank you dear.

    – Sajjad Dehghani
    Jan 1 at 9:01
















1












1








1







Best you can do in-browser without being able to disable a Print Preview you can achieve it via CSS media queries, the @media screen should be hidden, and @media print should not.






share|improve this answer













Best you can do in-browser without being able to disable a Print Preview you can achieve it via CSS media queries, the @media screen should be hidden, and @media print should not.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 1 at 8:09









Drew ReeseDrew Reese

950211




950211













  • OK, Thank you dear.

    – Sajjad Dehghani
    Jan 1 at 9:01





















  • OK, Thank you dear.

    – Sajjad Dehghani
    Jan 1 at 9:01



















OK, Thank you dear.

– Sajjad Dehghani
Jan 1 at 9:01







OK, Thank you dear.

– Sajjad Dehghani
Jan 1 at 9:01






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993869%2fhow-to-send-hidden-information-to-printer-to-print%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas