... |
... |
@@ -200,8 +200,31 @@ |
200 |
200 |
; URL parameter |
201 |
201 |
: Additional URL parameters added to the URL used when opening the form with Selenium. You can use URL parameters to [[prefill form fields>>Formcycle.Designer.Form.URLParameter]] or access them from within JavaScript. |
202 |
202 |
|
203 |
|
-== CSS-Anpassungen für Druckbild == |
|
203 |
+== CSS adjustments == |
204 |
204 |
|
|
205 |
+General CSS adjustments can be done via a corresponding media query: |
|
206 |
+ |
|
207 |
+{{code language="css"}} |
|
208 |
+@media print { |
|
209 |
+ /* general CSS for printing */ |
|
210 |
+} |
|
211 |
+{{/code}} |
|
212 |
+ |
|
213 |
+Please note this CSS is applied in other printing contexts as well, e.g. when the user prints the form via the browser directly. |
|
214 |
+ |
|
215 |
+There are a few special CSS classes available that are set only when the print service is used. These classes are always added to the //form.xm-form// element.(requires at least print plugin version 4.2.0 and print server plugin 1.4.0). |
|
216 |
+ |
|
217 |
+; xm-print |
|
218 |
+: This CSS class is always set. |
|
219 |
+; xm-print--mode-plain |
|
220 |
+: Added when print mode is set to //Preserve form fields//. |
|
221 |
+; xm-print--mode-dynamic |
|
222 |
+: Added when print mode is set to //Convert form fields to text//. |
|
223 |
+; xm-print--style-filled |
|
224 |
+: Added when the option //blank form// is disabled. |
|
225 |
+; xm-print--style-blank |
|
226 |
+: Added when the option //blank form// is enabled. |
|
227 |
+ |
205 |
205 |
=== Input elements === |
206 |
206 |
|
207 |
207 |
To optimize the form for printing, form elements of type [[input field>>Formcycle.Designer.Form.FormElements.Input]], [[text area>>Formcycle.Designer.Form.FormElements.Textarea]] und [[select>>Formcycle.Designer.Form.FormElements.Selection]] (Drop-Down) may be converted to plain text fields, if the print mode is set to Input elements as text. |
... |
... |
@@ -290,6 +290,41 @@ |
290 |
290 |
|
291 |
291 |
In fonts of type //TrueType// and //OpenType// information about the embeddability of the font can be stored directly. Depending on what is configured there, a font may not be embeddable and will instead be rendered by the //Print-Service-Plugin// only as a vector graphic in the created PDF documents. |
292 |
292 |
|
|
316 |
+== JavaScript adjustments == |
|
317 |
+ |
|
318 |
+Sometimes you may have to execute custom JavaScript code before the form is printed. For this, you can use the function //$.xutil.onPrint//. Its signature is as follows: |
|
319 |
+ |
|
320 |
+{{code language="text"}} |
|
321 |
+function onPrint(callback: () => Promise<void> | void): void |
|
322 |
+{{/code}} |
|
323 |
+ |
|
324 |
+This function lets you register one or more callbacks that are run before the form is printed. When a callback returns a promise, the print server waits until the promise fulfills before proceeding with the printing. In case the promise gets rejected, the error is logged, but the print is not aborted. Please note that you must register the callback before the form is printed, e.g. within a JQuery document-ready-handler (//$(callback)//). |
|
325 |
+ |
|
326 |
+For example, to run an AJAX request and wait for it to finish before the form is printed: |
|
327 |
+ |
|
328 |
+{{js}} |
|
329 |
+ $.xutil.onPrint(async () => { |
|
330 |
+ const response = await fetch("http://some-url.de"); |
|
331 |
+ // do something with response |
|
332 |
+ }); |
|
333 |
+{{/js}} |
|
334 |
+ |
|
335 |
+{{jsIE}} |
|
336 |
+ $.xutil.onPrint(function() { |
|
337 |
+ return new Promise(function(resolve, reject) { |
|
338 |
+ $.ajax("http://some-url.de", { |
|
339 |
+ success: function(data, textStatus, jqXHR) { |
|
340 |
+ // Do something with the response data |
|
341 |
+ resolve(undefined); |
|
342 |
+ }, |
|
343 |
+ error: function(jqXHR, textStatus, errorThrown) { |
|
344 |
+ reject("HTTP request error: " + textStatus + " - " + errorThrown); |
|
345 |
+ }, |
|
346 |
+ }); |
|
347 |
+ }); |
|
348 |
+ }); |
|
349 |
+{{/jsIE}} |
|
350 |
+ |
293 |
293 |
== Changelog |
294 |
294 |
|
295 |
295 |
=== 4.2.0 |