I have a probelm regarding printing a jsp page.
When i print my page from browser, which comes in poppup window. then right sideof page is cutoff. that page contain main table tag which defines the complete layout.all data are td tag. I tried to change width and also margins in the page but that is not working.I don't want to change my printer settings. Because my settings are standard. so please provide me solution in my code.

Dani AI

Generated

: the thing the browser actually prints is the HTML/CSS your JSP generates. was correct that you need to inspect the produced markup; was also right that print margins and paper size can cause clipping. The practical approach is to (a) find any fixed-width containers or overflow rules in the popup, and (b) add a small print stylesheet that forces content to fit the printable area.

Quick troubleshooting checklist:

  • Open the popup, use View Source or Developer Tools to find elements with fixed pixel widths, absolute positioning, or overflow:hidden.
  • Use Print Preview to note paper size (A4 vs Letter) and whether content extends beyond the printable region.
  • Add an @media print stylesheet to remove nonessential UI, constrain images/tables with max-width:100%, and allow cell text to wrap so long strings do not push layout wider than the page.
  • If you must keep wide tables, consider converting them to a print-friendly layout or breaking columns for print.

Example print rules to try (place in a print stylesheet or inside an @media print block):

@page { size: auto; margin: 10mm; }

@media print {
  html, body { margin: 0; padding: 0; }
  .no-print, nav, .sidebar { display: none !important; }
  table { width: auto !important; max-width: 100% !important; table-layout: auto !important; }
  img, iframe { max-width: 100% !important; height: auto !important; }
  td, th { overflow-wrap: break-word; word-wrap: break-word; white-space: normal !important; }
}

Note: @page and some print CSS behave differently across browsers; always check Print Preview. See MDN for print media rules and the W3C page spec for details: @media on MDN and CSS2 @page (W3C).

Recommended Answers

All 2 Replies

you can see/or print jsp page in your browser :P

jsp is a script that output html code.

You want a solution in your code....and you don't post the code ?

This is a problem with a browser setting, not the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.