Changes for page Print-Service-Plugin


From version 9.1
edited by awa
on 13.06.2022, 18:29
Change comment: There is no comment for this version
To version 10.2
edited by awa
on 14.06.2022, 14:28
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -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.
... ... @@ -289,3 +289,75 @@
289 289  Fonts sometimes have very tightly defined license terms and are priced differently depending on their intended use. It should be noted that fonts for creating PDFs must be embedded in them, which for many commercial fonts requires a different license than for delivery via a web server for the purpose of displaying a web page in a web browser.
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.
315 +
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 +
351 +== Changelog
352 +
353 +=== 4.2.0
354 +
355 +* feature: New option //blank form//
356 +* 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.
357 +* 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.
358 +* 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.
359 +
360 +=== 4.1.2
361 +
362 +* Added note regarding //$.xutil.onPrint// to the plugin UI.
363 +
364 +=== 4.1.1
365 +
366 +* Requires at least {{formcycle/}} 7.0.4.
367 +* change: Note regarding required field is not shown anymore.
368 +* fix: Show the date format immediately
369 +
370 +=== 4.1.0
371 +
372 +* Added a new option for selecting the workflow state used during printing. When no state is selected, the current state of the form record is used as in previous version.
373 +* Configured user groups are saved correctly.
374 +
375 +=== 4.0.2
376 +
377 +* feature: Added a new timeout option that defaults to 30 seconds. When the print service cannot be reached, the workflow may never complete otherwise.
378 +
379 +=== 4.0.1
380 +
381 +* fix: The PDF document tha was created was not attached to the form record (only for the new workflow action).
382 +
383 +=== 4.0.0
384 +
385 +* Adjustments for {{formcycle/}} version 7.
386 +