Overview

This document is about  to  make the intended part of page as printable.

 Technologies and Tools Used

The following technologies have been used to compare objects.

  • Oracle Apex

 Use Case

Let us have the requirement on  to make the intended part of page as printable in oracle apex.

 Steps with Screenshot

It can be done with Javascript. The following Javascript code, make the intended part of page as printable.

Step 1:

Create a region “ Printable”  and enter static id as “doc”.

Step 2:

Create On click  Dynamic Action  “Print” . In True Action, Select type  “Execute JavaScript Code”,then paste the below code in it. Click Save and Run the page.

Javascript Code :

var sTable = $(“#doc .t-Region-bodyWrap”).html();

var style = “<style>”;

style = style + “.table {width: 100%;font: 8px Calibri;}”;

style = style + “.table, th, td { border-collapse: collapse;”;

style = style + “padding: 2px 2px;}”;

style = style + “</style>”;

var win = window.open(”, ”, ‘height=700,width=700’); // SET THE PAGE HEIGHT AND WIDTH

win.document.write(‘<html><head>’);

win.document.write(‘<title>Printable Page</title>’);   // FOR PDF HEADER

win.document.write(style);          // ADD STYLE

win.document.write(‘</head>’);

win.document.write(‘<body>’);

win.document.write(sTable);         // PRINT PART OF THE PAGE

win.document.write(‘</body></html>’);

win.document.close();     // CLOSE THE CURRENT WINDOW.

win.print();    // PRINT THE INTENDED PART

Step 3:

Click Button “Print” to  make the intended part of page as printable.

Output:

Recent Posts

Start typing and press Enter to search