From 9e07128eee6741b3b0042bf96ff6a558a1c9eb32 Mon Sep 17 00:00:00 2001 From: "Matteo V." Date: Fri, 6 Dec 2024 09:34:47 +0100 Subject: [PATCH] Fix #10692 print bug when trying to print (#10706) --- web/client/components/print/PrintPreview.jsx | 8 +++++++- web/client/themes/default/less/print.less | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/web/client/components/print/PrintPreview.jsx b/web/client/components/print/PrintPreview.jsx index c7b1b75ac5..824c8f43d0 100644 --- a/web/client/components/print/PrintPreview.jsx +++ b/web/client/components/print/PrintPreview.jsx @@ -11,9 +11,15 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Glyphicon } from 'react-bootstrap'; -import { Document, Page } from 'react-pdf'; +import { pdfjs, Document, Page } from 'react-pdf'; import Button from '../misc/Button'; +import 'react-pdf/dist/Page/TextLayer.css'; +import 'react-pdf/dist/Page/AnnotationLayer.css'; +pdfjs.GlobalWorkerOptions.workerSrc = new URL( + 'pdfjs-dist/build/pdf.worker.min.js', + import.meta.url +).toString(); class PrintPreview extends React.Component { static propTypes = { diff --git a/web/client/themes/default/less/print.less b/web/client/themes/default/less/print.less index f347519f48..03abb1d697 100644 --- a/web/client/themes/default/less/print.less +++ b/web/client/themes/default/less/print.less @@ -34,6 +34,9 @@ border-width: 1px; border-style: solid; } + .react-pdf__Page { + background-color: unset !important; + } #print_preview { .ol-rotate { background-color: transparent;