Benutzer-Werkzeuge

Webseiten-Werkzeuge


Plugin installed incorrectly. Rename plugin directory 'swiftmail.backup' to 'swiftmail'.
projekt:jsfundgrube:smartform_printer

Inhaltsverzeichnis

Druckfunktion Smartform

In der Smartform folgendes DIV einfügen.

<div initMethod="preparePrint" style="cursor:pointer;display:block"><img src='/loom-portal/resrc/img/png/printer.png' /></div>

In der custom.js muss jquery eingebunden sein. Falls dies nicht der Fall ist beim Laden der Smartform

jq= (this.form.ownerDocument.defaultView!=null) ? this.form.ownerDocument.defaultView.jQuery : this.form.ownerDocument.parentWindow.jQuery;

ausführen. Dies geschieht am besten in der initmethod die fast bei jedem Prozess automatisch geladen wird.

Beim Drucken bitte den Druckertreiber auf „auf Seite anpassen“ auswählen


Es muss nur noch die preparePrint Funktion in die custom.js eingefügt werden.

gadget.functions.preparePrint = function () {
 function adjustMaskSize() {
  var fullSizeDiv = document.getElementById("printFullSize");
  fullSizeDiv.style.width = '0';
  fullSizeDiv.style.height = '0';
  fullSizeDiv.style.height = document.body.scrollHeight + 'px';
  fullSizeDiv.style.width = document.body.scrollWidth + 'px';
 }
 var getParentWindow = function (obj) {
  var d = obj && obj.ownerDocument ? obj.ownerDocument : doc;
  return d.parentWindow || d.defaultView;
 };
 this.innerHTML="<img src='/loom-portal/resrc/img/png/printer.png' />";
 this.style.cursor="pointer";
 
 this.onclick=function()
 {
  this.style.display="none";
  var html = '<html><head><title>Print view</title><script>\n' + adjustMaskSize.toString() + '\n</script>';
  jq=getParentWindow(this).jQuery;
  // adding styles
  jq('link[href$=".css"]').each(function (idx, el) {
   // Util.log("found link: " + el.href);
   html += jq(el).clone().wrap('<div>').parent().html();
  });
 
  html += '</head><body class="printVersion" onload="adjustMaskSize()" onresize="adjustMaskSize()">' +
  '<div id="fullSize">&nbsp;</div><div>';
 
  jq('form').each(function() {
   html += jq(this).clone().wrap('<div>').parent().html().replace('id="local_zone"', 'class="local_zone"');
  });
 
  html += '</div></body></html>';
 
  var popupWindow = window.open('', '_blank',
  'menubar=no,addressbar=no,location=no,resizable=yes,scrollbars=yes,status=no');
  popupWindow.document.open();
  popupWindow.document.write(html);
  popupWindow.document.close();
  popupWindow.print();
 
  this.style.display="block";
 
 }
};
projekt/jsfundgrube/smartform_printer.txt · Zuletzt geändert: 2021/07/01 09:52 (Externe Bearbeitung)