Product EngineeringFeaturesRemote Printer (lh-print)

Browser Integration

How the web application triggers the remote printer via custom protocol handlers.

👤 Aditya Naresh📅 Updated: Apr 20, 2026📁 Remote Printer

Browser Integration

The "frontend" of the remote printer feature is primarily responsible for generating and triggering the custom URI scheme that the local lh-print utility understands.

Protocol Structure

The application uses the lhprint:// custom URI scheme. The data following the scheme is a caret-separated (^) string containing the print mode and patient details.

URI Format

lhprint://<MODE>^<PATIENT_NAME>^<AGE>^<GENDER>^<PATIENT_ID>^<ORG_CODE>^<DATE>^<SAMPLE_ID>^<SAMPLE_TYPE>^<TESTS>^<BILL_ID>

  • MODE 0: PRN disabled PDF printing.
  • MODE 1: PRN1: Prints the data that's visible on the browser
  • MODE 2: PRN2: This will fetch all the related data from the backend and then print.

Triggering via JavaScript

To trigger a print, the frontend simply redirects the browser window or opens an iframe with the constructed lhprint:// URL.

const triggerRemotePrint = (patientData) => {
  const protocolUrl = `lhprint://${patientData.mode}^${patientData.name}^...`;
  window.location.href = protocolUrl;
};

Browser Behavior

1. Permission Prompt

The first time a print is triggered, modern browsers (Chrome, Edge) will show a security prompt: "Always allow [Site Domain] to open links of this type in the associated app?"

Users must check the box and click Open for the print to proceed.

2. Protocol Confirmation

Browsers determine which application to launch by looking at the HKEY_CLASSES_ROOT\lhprint registry key. If the registry entry is missing, the browser will do nothing or show a "No app found" error.

Troubleshooting

"Nothing happens when I click Print"

  • Registry Missing: Ensure lh-print.reg has been merged on the local machine.
  • Path Error: Check that the command value in the registry points to the correct lh-print.exe path.
  • Browser Blocked: Check browser settings under Settings -> Cookies and site permissions -> Protocol handlers to ensure the site isn't blocked.

"Browser shows a search page instead of printing"

  • This usually happens if the lhprint:// protocol is not registered. Windows treats it as a search query rather than a deep link.

Bulk Print Limit

Note that URLs have character limits (approx 2000-8000 characters depending on the browser). For extremely large bulk prints, using Mode 2 (API Fetch) is recommended to keep the URI short.

On this page