<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Slideshow Module with PDF support]]></title><description><![CDATA[<p dir="auto">Hey guys,</p>
<p dir="auto">I need your help :).</p>
<p dir="auto">My module “Pictures” can show any kind of pictures, located on a mounted network drive. On startup node_helper mounts a specific drive, then it scans this folder every two seconds (it could be any other value) and write all filenames in a text file. Pictures imports and filters this file. At the end it generates a slideshow.</p>
<p dir="auto">Now I want to implement pdf files in the same way. Actually it works with a little workaround but I’m not happy with that. I have to start MagicMirror and additionally I have to start another browser (unfortunatelly “node serveronly” doesn’t work) on the pi to show pdf files with the integrated plugin.</p>
<p dir="auto">For that I have several questions^^:</p>
<ul>
<li>Is there a possibility to show pdf files native in my module?</li>
<li>My slideshow is a little laggy on the pi (3B). Any PC with the same network connection shows the same slideshow in browser with perfect performance. Can I improve my slideshow performance anyhow?</li>
<li>I have a problem to run “node serveronly” with raspian stretch an the new MagicMirror 2.3.1. I can start but as soon as I connect to the pi by IP:8080 my module generates -75 errors. This won’t happen if MagicMirror runs with “npm start”.</li>
</ul>
<p dir="auto">Best regards<br />
flash</p>
<p dir="auto"><strong>node_helper.js</strong></p>
<pre><code>var request = require('request');
var NodeHelper = require("node_helper");
const exec = require('child_process').exec;

module.exports = NodeHelper.create({

	start: function() {
		this.started = false;
	},

	socketNotificationReceived: function(notification, payload) {
		if (notification === "CONFIG" &amp;&amp; this.started == false) {	
			this.config = payload;
			// mounting network drive
			exec("/usr/bin/sudo mount -t cifs -o user=" + this.config.user + ",password=" + this.config.password + " " + this.config.source + " /home/pi/MagicMirror/modules/Pictures/images", null);
			this.started = true;
		}		
		if (notification === "GET_PICTURE_DATA" &amp;&amp; this.started) {
			var path = "/home/pi/MagicMirror/modules/Pictures/images/"+ this.config.folder + "/";
			var opt1 = '-type f ! -path "/home/pi/MagicMirror/modules/Pictures/images/' + this.config.folder + '/.thumb/*" | awk -F"/"'
			var opt2 = '{print $NF"/" }';
			var opt3 = '| sort &gt; ~/MagicMirror/modules/Pictures/files.txt';
			
			exec("find " + "'" + path + "' " + opt1 + " '" + opt2 + "' " + opt3, null);
			this.getData(payload);
		}
	},

	getData: function(options) {
		request(options, (error, response, body) =&gt; {
			this.sendSocketNotification("PICTURE_DATA", body); 
		});
	}
});
</code></pre>
<p dir="auto"><strong>Pictures.js</strong></p>
<pre><code>var showPicture = 0;
var textdata = [];
var textdataHelp = [];
var findExt = [];

Module.register("Pictures",{
    defaults: {
        loadingText: 'Lade SlideShow...',
		pictureInterval: 20 * 1000,			
    },
	
	start: function() {
		Log.info("Starting module: " + this.name);	
		this.loaded = false;		
		this.sendSocketNotification('CONFIG', this.config);
		this.locationSelf = window.location.href;
		this.file = 'modules/Pictures/files.txt';	
		setTimeout(this.updateFiles, 2000, this);
	},

	socketNotificationReceived: function(notification, payload){
		if(notification === 'PICTURE_DATA' &amp;&amp; payload !== null){
			this.loaded = false;
			textdataHelp = payload.split("/\n");			
			if (textdataHelp[0] !== ""){
				textdata = []; // textdata will not be cleared, if helper has no content
			}
			for (i = 0; i  textdata.length - 1) {
				showPicture = 0;	
			}	
			self.updateDom(1000);
			showPicture++;
		}
    },	
	
    getDom: function() {
		var wrapper = document.createElement("div");	
        var pictureInfo = document.createElement('table');

        if (!this.loaded) {
            wrapper.innerHTML = this.config.loadingText;
            return wrapper;
        }
		var currCount = showPicture + 1;
        var tableHead = document.createElement('tr');
		tableHead.className = 'normal small';
		
		var y = 0
		findExt = textdata[showPicture].split(".");
		for (i = 0; i  0){ 
			//tableHead.innerHTML = '&lt;br /&gt;' + currCount + '/' + textdata.length;
			tableHead.innerHTML = '&lt;br /&gt;' + currCount + '/' + textdata.length;

		}else{
			tableHead.innerHTML = '&lt;img src="' + this.locationSelf + 'modules/Pictures/images/' + this.config.folder + '/' + textdata[showPicture] +'" alt="Vorschau" /&gt;&lt;br /&gt;' + currCount + '/' + textdata.length;

		}
		
		y = 0;
		findExt = [];
		
        pictureInfo.appendChild(tableHead);		
		
		wrapper.appendChild(pictureInfo);	
        return wrapper;
    },	
	
});
</code></pre>
]]></description><link>https://forum.magicmirror.builders/topic/7089/slideshow-module-with-pdf-support</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 14:43:44 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/7089.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Apr 2018 18:49:25 GMT</pubDate><ttl>60</ttl></channel></rss>