Changes for page Sheet

Last modified by SuperNico Laub on 2025/09/18 17:55

From version 1.1
edited by superadmin
on 2025/05/22 17:45
Change comment: Install extension [org.xwiki.platform:xwiki-platform-export-pdf-ui/16.10.8]
To version 2.1
edited by SuperNico Laub
on 2025/09/18 17:55
Change comment: Install extension [org.xwiki.platform:xwiki-platform-export-pdf-ui/17.7.0]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.superadmin
1 +xwiki:XWiki.supernico
XWiki.JavaScriptExtension[0]
Code
... ... @@ -628,6 +628,18 @@
628 628   };
629 629  
630 630   /**
631 + * Lazy image loading (when the image is scrolled into view port) doesn't make sense for PDF export (printing).
632 + * Paged.js needs to wait for all images to be loaded (even if they are not in the view port) in order to know how to
633 + * split the content into print pages (e.g. to know if an image fits on the current print page or has to be moved to
634 + * the next one).
635 + */
636 + function preventLazyImageLoading() {
637 + document.querySelectorAll('#xwikicontent img[loading="lazy"]').forEach(image => {
638 + image.removeAttribute('loading');
639 + });
640 + }
641 +
642 + /**
631 631   * Removes the image size (width and height) from the image URL query string in order to prevent the server-side
632 632   * resize of the image, thus allowing the full size image to be included in the generated PDF.
633 633   */
... ... @@ -668,6 +668,7 @@
668 668   storeFormFieldValues();
669 669   makeTableCellWidthRelative();
670 670   preserveWhiteSpaceInCodeBlocks();
683 + preventLazyImageLoading();
671 671   });
672 672  
673 673   // Trigger the print preview after the page is ready. Note that by returning a promise we're making the next page