Introduction
Silent PDF printing enables web applications to print documents directly to printers without user interaction or print dialogs. While web browsers typically require user confirmation for security reasons, Chrome Kiosk Mode provides a solution for controlled environments where automated printing is essential.
This documentation demonstrates silent printing implementation using ReportFactory within Oracle APEX, though the principles apply to any web application capable of generating PDF documents.
Watch Demo
Use Cases
-
Point of Sale (POS) Systems - Automatic receipt and invoice printing
-
Kiosk Applications - Self-service document printing in retail, healthcare, or government facilities
-
Manufacturing Environments - Automated label and work order printing
-
Warehouse Operations - Silent shipping label and packing slip generation
-
Restaurant Systems - Kitchen order printing without staff intervention
-
Ticketing Systems - Automatic ticket printing at entry points
Chrome Kiosk Mode Overview
Chrome Kiosk Mode launches the browser in a locked, full-screen state with enhanced permissions. The --kiosk-printing
flag specifically enables silent printing capabilities, bypassing standard browser security restrictions that normally require user confirmation for print operations.
Key benefits:
-
Eliminates print dialog interactions
-
Provides full-screen application experience
-
Enables automated printing workflows
-
Maintains security through controlled environment deployment
Implementation Scripts
Windows Script
Save as start-kiosk-mode.bat
:
Remember to update the Chrome path and URL for your environment.
@echo off
"C:\Program Files\Google\Chrome\Application\chrome.exe" ^
--kiosk ^
--kiosk-printing ^
--disable-web-security ^
--user-data-dir="%TEMP%\chrome-kiosk-data" ^
--disable-features=VizDisplayCompositor ^
--disable-background-timer-throttling ^
--disable-backgrounding-occluded-windows ^
--disable-renderer-backgrounding ^
--disable-infobars ^
--disable-extensions ^
--no-first-run ^
--no-default-browser-check ^
--autoplay-policy=no-user-gesture-required ^
"https://gc7408d12e6525b-mtc01apexdb.adb.ap-hyderabad-1.oraclecloudapps.com/ords/r/arfldemo/arf-lite/login"
macOS Script
Save as start-kiosk-mode.sh
:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--kiosk \
--kiosk-printing \
--disable-web-security \
--user-data-dir="/tmp/chrome-kiosk-data" \
--disable-features=VizDisplayCompositor \
--disable-background-timer-throttling \
--disable-backgrounding-occluded-windows \
--disable-renderer-backgrounding \
--disable-infobars \
--disable-extensions \
--no-first-run \
--no-default-browser-check \
--autoplay-policy=no-user-gesture-required \
"https://gc7408d12e6525b-mtc01apexdb.adb.ap-hyderabad-1.oraclecloudapps.com/ords/r/arfldemo/arf-lite/login"
Make executable: chmod +x
start-kiosk-mode.sh
JavaScript Implementation (ReportFactory Example)
javascript:(function() {
var reportName = 'INVOICE';
var reportParam = '[{"parameter_name": "p_order_id","parameter_value": "' + apex.item('P22_ORDER_ID').getValue() + '"}]';
var outputName = 'invoice';
var renderMode = 'P';
console.log(reportParam);
var encodedReportParam = encodeURIComponent(reportParam);
apex.server.process("ARF_LITE_PREPARE_URL", {
x01: reportName,
x02: encodedReportParam,
x03: outputName,
x04: renderMode
}, {
dataType: 'text',
success: function(pData) {
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.src = pData;
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.print();
apex.message.showPageSuccess('Print job submitted successfully');
}, 1000);
};
document.body.appendChild(iframe);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("Error in APEX process: " + errorThrown);
apex.message.alert("An error occurred while preparing the report URL.");
}
});
})();