question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running electron-pdf in a docker container produces no output

See original GitHub issue

Hi there.

I’m trying to running electron-pdf cli in a docker container with Xvfb but the cli produces no output and dont generate the pdf file. Any idea what could happening or how could I debug it to find the problem? I’ve tried several configurations in Dockerfile but all of them produces the same result .

This is my actual Dockerfile:

FROM node:slim

# Electron support (from: http://askubuntu.com/a/510186)
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' && \
    apt-get update -y && \
    apt-get install -y google-chrome-stable xvfb

RUN Xvfb -screen 1280x2000x32 :0 & export DISPLAY=:0

COPY ./ pdfbuilder
WORKDIR pdfbuilder
RUN npm install -g electron-pdf
RUN npm install --production

EXPOSE 80
ENV PORT 80

CMD ["node", "index.js"]

This is my test in index.js:

var exec = require("child_process").exec;

console.log("verifying electron-pdf");
exec("electron-pdf ./views/index.html ./teste.pdf", function (err, stdout, stderr) {
    console.log(stdout); //no output
    console.log(stderr); //no output
    if (err) {
        console.log("Error verifying electron-pdf");
        console.log(err.stack);
    } else {
        console.log("electron-pdf OK!"); //shows output, but no pdf generated
    }
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
sergiofmcommented, May 24, 2017

I’ve found out what was the problem with the fonts.

I have to put a file called .fonts.conf in the /root with this content:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
  </match>
  <match target="font">
    <edit name="hintstyle" mode="assign"><const>hintnone</const></edit>
  </match>
  <match target="font">
   <edit mode="assign" name="hinting"><bool>false</bool></edit>
  </match>
</fontconfig>

This make all the fonts work like a charm.

0reactions
codecounselorcommented, May 24, 2017

Sound’s like you’ve got this resolved, I’m going to close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running electron-pdf in a docker container produces no output
I'm trying to running electron-pdf cli in a docker container with Xvfb but the cli produces no output and dont generate the pdf...
Read more >
Executable file produces no output, silently fails in Windows ...
This .exe should produce this output when called from the command line in any directory, and the permissions are good. However when ran...
Read more >
Docker run does not display any output - Stack Overflow
But running docker run hello-world produce no output. Note on very first time I got additional messages regard installing image. Unable to find ......
Read more >
How to Live Tail Docker Logs - Papertrail
Every container produces logs with valuable information. ... Therefore, you won't see any logging or other output from your Docker container.
Read more >
jsreport/jsreport - Gitter
i'm up and running with docker image - but keep getting this error ... { "allowedModules": ["*"] } } - then restarted the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found