Changes for page Print-Service-Plugin


From version 10.1
edited by awa
on 14.06.2022, 13:52
Change comment: Add changelog
To version 10.3
edited by awa
on 14.06.2022, 14:29
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -177,8 +177,8 @@
177 177  The described steps are only a workaround and the environment variables should be set back to the default values after the successful installation!
178 178  
179 179  {{code language="none"}}
180 -PS C:\test> $env:NODE_TLS_REJECT_UNAUTHORIZED = 0
181 -PS C:\test> npm set strict-ssl false
180 +PS C:\test> $env:NODE_TLS_REJECT_UNAUTHORIZED = 0
181 +PS C:\test> npm set strict-ssl false
182 182  {{/code}}
183 183  
184 184  == Usage and options ==
... ... @@ -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,11 +290,47 @@
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
296 296  
297 297  * feature: New option //blank form//
356 +* feature: Add special CSS classes to the //form.xm-form// such as //xm-print//
298 298  * change: When an element is marked as hidden during print in the form designer (advanced -> Word and PDF export options), the element is now hidden when the print service is used as well. This feature requires at least {{formcycle/}} version 7.0.14.
299 299  * change: Applicable only when //print mode// is set to //dynamic//: When an input field did not have a value, its placeholders was shown instead. This was changed so that no value is shown when the input field does not have a value.
300 300  * change: Applicable only when //print mode// is set to //dynamic//: When a select field displayed as a dropdown menu did not have a value, the text //Please select// was shown instead. This was changed so that no text is shown anymore when the select field does not have a value.