From a08a0d33e1f428fbcbbf5b94ace235d61e59c542 Mon Sep 17 00:00:00 2001
From: Gustavo Trott <gustavo@trott.com.br>
Date: Mon, 19 Apr 2021 16:01:48 -0300
Subject: [PATCH] Makes presentation svg resolution configurable, and set
 default to 300

---
 .../bigbluebutton/presentation/imp/SvgImageCreatorImp.java  | 6 +++++-
 bigbluebutton-web/grails-app/conf/bigbluebutton.properties  | 5 +++++
 bigbluebutton-web/grails-app/conf/spring/doc-conversion.xml | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SvgImageCreatorImp.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SvgImageCreatorImp.java
index de011acccb..01659895df 100755
--- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SvgImageCreatorImp.java
+++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SvgImageCreatorImp.java
@@ -30,6 +30,7 @@ public class SvgImageCreatorImp implements SvgImageCreator {
     private long imageTagThreshold;
     private long pathsThreshold;
     private int convPdfToSvgTimeout = 60;
+    private int svgResolutionPpi = 300;
 	private String BLANK_SVG;
 
     @Override
@@ -253,7 +254,7 @@ public class SvgImageCreatorImp implements SvgImageCreator {
 
     private NuProcessBuilder createConversionProcess(String format, int page, String source, String destFile,
             boolean analyze) {
-        String rawCommand = "pdftocairo -r " + (analyze ? " 300 " : " 150 ") + format + (analyze ? "" : " -singlefile")
+        String rawCommand = "pdftocairo -r " + this.svgResolutionPpi + " " + format + (analyze ? "" : " -singlefile")
                 + " -q -f " + String.valueOf(page) + " -l " + String.valueOf(page) + " " + source + " " + destFile;
         if (analyze) {
             rawCommand += " && cat " + destFile;
@@ -310,4 +311,7 @@ public class SvgImageCreatorImp implements SvgImageCreator {
         this.convPdfToSvgTimeout = convPdfToSvgTimeout;
     }
 
+    public void setSvgResolutionPpi(int svgResolutionPpi) {
+        this.svgResolutionPpi = svgResolutionPpi;
+    }
 }
diff --git a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties
index 06ff3cc963..d0a309d8ae 100755
--- a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties
+++ b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties
@@ -103,6 +103,11 @@ numFileProcessorThreads=2
 #------------------------------------
 svgConversionTimeout=60
 
+#------------------------------------
+# Presentation resolution, in PPI (will be set to generated svg)
+#------------------------------------
+svgPresentationResolutionPpi=300
+
 #------------------------------------
 # Timeout(secs) to wait for conversion script execution
 #------------------------------------
diff --git a/bigbluebutton-web/grails-app/conf/spring/doc-conversion.xml b/bigbluebutton-web/grails-app/conf/spring/doc-conversion.xml
index b98c13fa43..1120fe7dbb 100755
--- a/bigbluebutton-web/grails-app/conf/spring/doc-conversion.xml
+++ b/bigbluebutton-web/grails-app/conf/spring/doc-conversion.xml
@@ -87,6 +87,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
         <property name="pathsThreshold" value="${placementsThreshold}"/>
         <property name="blankSvg" value="${BLANK_SVG}"/>
         <property name="convPdfToSvgTimeout" value="${svgConversionTimeout}"/>
+        <property name="svgResolutionPpi" value="${svgPresentationResolutionPpi}"/>
     </bean>
 
     <bean id="generatedSlidesInfoHelper" class="org.bigbluebutton.presentation.GeneratedSlidesInfoHelperImp"/>
-- 
GitLab