diff --git a/record-and-playback/core/lib/recordandplayback/generators/presentation.rb b/record-and-playback/core/lib/recordandplayback/generators/presentation.rb
index 0c7406f9245dffbc625528aee2cd26f2ad34afac..10b3d66b623e3bea6c7eb7a6f8ed1b387edb7687 100755
--- a/record-and-playback/core/lib/recordandplayback/generators/presentation.rb
+++ b/record-and-playback/core/lib/recordandplayback/generators/presentation.rb
@@ -47,20 +47,31 @@ module BigBlueButton
       # In order to handle portrait docs better, scale to a square based on
       # the larger of height, width in the resize parameter.
       scale = resize.split('x').map(&:to_i).max
-      BigBlueButton.logger.info("Task: Extracting a page from pdf file as png image")
+      BigBlueButton.logger.info('Task: Extracting a page from pdf file as png image')
       temp_out = "#{File.dirname(png_out)}/temp-#{File.basename(png_out, '.png')}"
-      command = "pdftocairo -png -f #{page_num} -l #{page_num} -scale-to #{scale} -singlefile #{pdf_presentation} #{temp_out}"
-      status = BigBlueButton.execute(command, false)
-      temp_out += ".png"
-      if status.success? and File.exist?(temp_out)
+      status = BigBlueButton.execute(
+        [
+          'pdftocairo', '-png', '-f', page_num.to_s, '-l', page_num.to_s, '-scale-to', scale.to_s, '-singlefile',
+          pdf_presentation, temp_out,
+        ],
+        false
+      )
+      temp_out += '.png'
+      if status.success? && File.exist?(temp_out)
         # Resize to the requested size
-        command = "convert #{temp_out} -resize #{scale}x#{scale} -quality 90 +dither -depth 8 -colors 256 #{png_out}"
-        status = BigBlueButton.execute(command, false)
+        status = BigBlueButton.execute(
+          [
+            'convert', temp_out, '-resize', "#{scale}x#{scale}", '-quality', '90', '+dither', '-depth', '8', '-colors', '256',
+            png_out,
+          ],
+          false
+        )
       end
-      if !status.success? or !File.exist?(png_out)
+      if !status.success? || !File.exist?(png_out)
         # If page extraction failed, generate a blank white image
-        command = "convert -size #{resize} xc:white -quality 90 +dither -depth 8 -colors 256 #{png_out}"
-        BigBlueButton.execute(command)
+        BigBlueButton.execute(
+          ['convert', '-size', resize, 'xc:white', '-quality', '90', '+dither', '-depth', '8', '-colors', '256', png_out]
+        )
       end
     ensure
       FileUtils.rm_f(temp_out)