# Implementing Custom HFE-UI Print Functionality

**URL:** <https://talk.openmrs.org/t/implementing-custom-hfe-ui-print-functionality/26582>\
**Category:** Development\
**Created:** [January 30, 2020, 5:49pm UTC](https://talk.openmrs.org/t/implementing-custom-hfe-ui-print-functionality/26582 "2020-01-30T17:49:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![long27km](https://talk.openmrs.org/letter_avatar/long27km/32/5_5575768a8748004e209b776fc1b2916d.png) [@long27km](https://talk.openmrs.org/u/long27km)\
**Post date:** [January 30, 2020, 5:49pm UTC](https://talk.openmrs.org/t/implementing-custom-hfe-ui-print-functionality/26582/1 "2020-01-30T17:49:53Z")

</div>

In HtmlFormEntryUI, the Print Button functionality is currently hardcoded to use the browser print dialog ([https://github.com/openmrs/openmrs-module-htmlformentryui/blob/c008d80ca04435d40d4d5abe59f3cd78a19b7801/omod/src/main/webapp/pages/htmlform/viewEncounterWithHtmlForm.gsp#L39](https://github.com/openmrs/openmrs-module-htmlformentryui/blob/c008d80ca04435d40d4d5abe59f3cd78a19b7801/omod/src/main/webapp/pages/htmlform/viewEncounterWithHtmlForm.gsp#L39)).

It would be useful to allow supporting setting an alternative URL in the href by creating an ui.pageLink() and adding a link target attribute, from the gsp model, allowing other modules to provide another method of printing if needed.

One of the bigger questions that arises is how should that data be passed from another module to the ViewEncounter ([https://github.com/openmrs/openmrs-module-htmlformentryui/blob/c008d80ca04435d40d4d5abe59f3cd78a19b7801/omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java#L17-L49](https://github.com/openmrs/openmrs-module-htmlformentryui/blob/c008d80ca04435d40d4d5abe59f3cd78a19b7801/omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java#L17-L49)) controller?

Does this approach sound reasonable and would a Global Property or two be acceptable for this purpose?

@mogoodrich @mksd

---

<div class="post-metadata">

**Author:** ![mogoodrich](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mogoodrich/32/3324_2.png) [@mogoodrich](https://talk.openmrs.org/u/mogoodrich)\
**Post date:** [January 30, 2020, 8:24pm UTC](https://talk.openmrs.org/t/implementing-custom-hfe-ui-print-functionality/26582/2 "2020-01-30T20:24:41Z")

</div>

A global property sounds reasonable to me @long27km… that seems like the simplest option and also seems “correct” because I think in the majority of cases an implementation will only have a single strategy for printing? (We _could_ pass in a new RequestParam to “ViewEncounterWithHtmlFormPageController” but that would likely be overkill and needlessly complicated?)

Take care, Mark

---

<div class="post-metadata">

**Author:** ![long27km](https://talk.openmrs.org/letter_avatar/long27km/32/5_5575768a8748004e209b776fc1b2916d.png) [@long27km](https://talk.openmrs.org/u/long27km)\
**Post date:** [January 30, 2020, 9:46pm UTC](https://talk.openmrs.org/t/implementing-custom-hfe-ui-print-functionality/26582/3 "2020-01-30T21:46:31Z")

</div>

Thanks, I’ll move forward with a Ticket and PR for this feature!
