JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript">
function openWin() {
var printWindow = window.open();
printWindow.document.open('text/plain')
printWindow.document.write(
'${^XA^FO50,100^BXN,10,200^FDYourTextHere^FS^XZ}$');
printWindow.document.close();
printWindow.focus();
printWindow.print();
}
</script>
<input type="button" value="Print code" onclick="openWin()" />