HTML Form Print

I am trying to print a page using javascript, it works fine, but the problem is with the form of the havign page inside. If we print the printed values ​​of the form, that's fine, but we get html controls (like input, dropdown). Can anyone have any other idea besides server side processing

0


a source to share


3 answers


You can attach a plot style sheet to your pages, for example ...

<link rel="stylesheet" href="print.css" media="print"/>

      

Then in the plot style sheet you can specify ...



input, select
{
    display: none;
}

      

This will hide the form controls, but only when the page is printed. You can expand on this by also hiding the navigation and links, i.e. anything that isn't useful in the print version of your web page.

EDIT: As correctly stated, if you want to still display values ​​in text files, etc., you can set the border-style property to "none" (+ whatever style declarations you think are fine). and only hide elements that have no printing purpose, like buttons

+7


a source


You can provide different css for printing and displaying the screen.



In your print css, you can probably get rid of most of the visible parts of the html controls by setting borders to nothing, background to white, etc. However, I haven't tried to get rid of it all, so you can still get the odd bit. It's worth a try, though.

0


a source


Yes. You will need to define a different CSS style that will support media="print"

. The printable CSS will hide the corresponding controls and render the static margins.

0


a source







All Articles