A drop-in print button for OutSystems Reactive Web that produces clean, uncluttered printouts instead of the ugly, chrome-filled default. Prints the whole screen or a specific area, hides navigation and buttons on paper, and gives developers a simple no-print class to mark anything they want kept off the page.
no-print
window.print() alone is a trap — it prints everything on the page: your top bar, side menu, buttons, footer, form controls, the works. Users end up with cluttered paper or ugly PDFs.
window.print()
Printly wraps window.print() with a print-friendly stylesheet that strips the usual Reactive Web chrome, a no-print class the developer can add to any widget they want kept off paper, and an option to print just a specific container instead of the whole page. Pure client-side, no dependencies.
TargetElementId
.oap
Printly Label = "Print"
Drop it on a screen, click it, and the browser opens its print dialog with a cleaned-up version of the page. That's the whole default flow.
Printly
Label
"Print"
""
Two inputs — nothing else. Everything else is styling, controlled via CSS.
Add the class no-print to any widget you want hidden on paper:
The Printly button itself already has no-print, so it never appears on the printout.
This is the primary way you tune what does and doesn't print.
Sometimes you don't want the whole page — you want just an invoice, a report, a receipt. Give that container an id and pass it as TargetElementId:
Container (Name: Invoice) [invoice content] Printly Label = "Print invoice" TargetElementId = Invoice.Id
When the button is clicked, everything on the page is temporarily hidden except that container, the print dialog opens with just it, and the on-screen layout is restored when the dialog closes. Neither the user nor other pages notice anything happened.
When printing (whole page or targeted), Printly applies a stylesheet that:
Click here (https://…)
If your app's theme uses non-standard class names for chrome and something slips through, either add no-print to that widget or override in your app theme:
@media print { .my-custom-nav { display: none !important; } }
When the user picks "Save as PDF," most browsers use the page's document.title as the default filename. Set your screen or page title accordingly before showing the Printly button, and the printed PDF gets a sensible default name.
document.title
Header/footer/menu still shows on the printout.Your theme probably uses non-standard class names for those regions. Either add no-print to the relevant widgets, or add a small @media print override in your app theme to hide them.
@media print
Nothing prints, or the page is blank.If you're using TargetElementId, make sure it references a real, rendered container. Test in the browser console: document.getElementById("YourId") should return an element, not null.
document.getElementById("YourId")
On-screen layout looks wrong after cancelling print.The block restores the layout on the browser's afterprint event, plus a 2-second safety timeout. If you see lingering wrong state, refresh the page — and tell us which browser, since afterprint behavior varies.
afterprint
Very long targets print oddly across pages.For most printouts (an invoice, a report section) the isolation works cleanly. Extremely tall targets that span many pages can have quirky page-break behavior in some browsers — a known limitation of print CSS in general, not specific to Printly.
I want to trigger printing from another action, not a button.Use the Printly block's built-in trigger by placing the block and calling its click via your own action, or roll your own window.print() call. Future versions may expose a public Print action for direct invocation.
Print
Published on the OutSystems Forge as open, reusable code. Free to use and adapt in your OutSystems projects.