Git Product home page Git Product logo

cmdlnprint's Introduction

Firefox cmdlnprint extension (DEPRECATED)

Firefox remove the API required to make this plugin work, it depends on XPCOM but it is not available anymore for use with extensions. There is no API on WebExtensions available to provide this functionality.

Alternative

The closest alternative to produce a high quality PDF file from web content is to create the file on server side using puppeteer and send to print from there. I think there is also a silent printing on the client using printjs but I didn't try it.

I hope that in the future Firefox can expose its printing API and make it possible to create a PDF file and produce silent printing again.

Authors and License

MPL 1.1/GPL 2.0/LGPL 2.1 as shown in file license.txt

cmdlnprint's People

Contributors

bdurrow avatar eclipxe13 avatar torisugari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

506124204

cmdlnprint's Issues

cmdlnprint blocks e10s rollout

Add-on {243cc1ee-c821-4544-aebb-54c44125b9aa} blocks e10s rollout.

I think this indicates that the plugin will be disabled on e10s builds soon.

Not working when run from a script on cron

Error: GDK_BACKEND does not match available displays

The same script works fine when run in bash in a terminal.
A window containing the HTML page is flashing , then a progress window for printing is shown for 2-3 seconds.

Is there a chance to run it --headless ?

The quick workaround is to install Xvfb and run in script with:

/usr/bin/xvfb-run /usr/bin/firefox -print "http://....html" -print-mode pdf . . .

Teo

Header and Footer options don't appear to do anything

Tested with FF51 When I have prefs.js with settings like this:

user_pref("print.print_footerleft", "");
user_pref("print.print_footerright", "");
user_pref("print.print_headerleft", "");
user_pref("print.print_headerright", "");

and I print with -print-footer-left left -print-footer-right right, I expect there to be a footer but I don't see one.

In FF11 the problem is worse as I can't turn off the default headers and footers with any combination of command line arguments or prefs.js modifications. I tested FF11 in Ubuntu trusty and centos 6.

[GFX1-]: D3D11 layers just crashed; D3D11 will be disabled.

This seems to only work for me once, then Firefox hangs and cmdlnprint won't run again until I reboot or do some serious clean-up. I get the error message: [GFX1-]: D3D11 layers just crashed; D3D11 will be disabled. ...then on subsequent runs, I get: [GFX1-]: D3D11 layers disabled due to a prior crash. but at lease it allows Firefox to close. In this case, the resulting PDF is unreadable by any viewer. I'm running Firefox v51.0.1 (32-bit). This happens from both the command line and a task scheduled .bat or .cmd file.

cmdlnprint does not work with Linux Firefox version 45 (ESR)

I use docker to test. I will include my Dockerfile, entrypoint.sh and build commands below.

Setup x11 forwarding like this:

xhost +local:docker && socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

Run commands are as follows(for each of 11,45,51 set ff_version below):

ff_version=<AS MENTIONED ABOVE>
ff_home=`pwd`/ff-home-${ff_version}
DOCKER_DISPLAY=<IP ADDRESS OF WORKSTATION RUNNING X>:0
mkdir ${ff_home}
#Verify version
docker run --rm --volume ${ff_home}:/home/firefox -e "DISPLAY=${DOCKER_DISPLAY}" -u `id -u` -e 'HOME=/home/firefox' ff:${ff_version} firefox -version
#Setup cmdlnprint after running this next command
docker run --rm --volume ${ff_home}:/home/firefox -e "DISPLAY=${DOCKER_DISPLAY}" -u `id -u` -e 'HOME=/home/firefox' ff:${ff_version} firefox
#Now the actual test
docker run --rm --volume ${ff_home}:/home/firefox -e "DISPLAY=${DOCKER_DISPLAY}" -u `id -u` -e 'HOME=/home/firefox' ff:${ff_version} firefox -print https://google.com -print-mode pdf -print-file /home/firefox/google.pdf

Results:

Mozilla Firefox 11.0 on ubuntu precise: PDF Produced
Mozilla Firefox 45.0.2 on ubuntu xenial: cmdlnprint windows displays but hangs
Mozilla Firefox 51.0.1 on ubuntu xenial: PDF Produced

In Firefox 45 I have confirmed that I can print to file in this same environment that cmdlnprint does not work. I printed to /home/firefox/mozilla.pdf and verified that the output was as expected.

I have tested in a similar manner with the same results with CentOS if you need me to prepare Dockerfile for CentOS I can do so but it would require some work to prepare from the version that I have for my solution.

Dockerfile

FROM ubuntu:latest
#FROM ubuntu:precise
#For Firefox Version 11 use precise (12.04)
#Ubuntu Current Stable is 16.04 aka xenial aka latest

ENV DEBIAN_FRONTEND noninteractive
ENV RUNUSER firefox
ENV UBUNTU_NICKNAME xenial
#ENV UBUNTU_NICKNAME precise
ARG FIREFOX_VERSION=51

RUN \
  useradd -m $RUNUSER && \
  sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
  echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_NICKNAME} multiverse" >> /etc/apt/sources.list.d/multiverse.list  && \
  echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_NICKNAME}-updates multiverse" >> /etc/apt/sources.list.d/multiverse.list && \
  echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_NICKNAME}-backports restricted universe multiverse" >> /etc/apt/sources.list.d/multiverse.list && \
  apt-get update && \
  apt-get install -y --no-install-recommends \
    dbus-x11 \
    firefox=${FIREFOX_VERSION}* \
    ttf-mscorefonts-installer \
    xvfb && \
  rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /tmp/entrypoint.sh
RUN chmod 755 /tmp/entrypoint.sh
ENTRYPOINT ["/tmp/entrypoint.sh"]

entrypoint.sh

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

DISPLAY=${DISPLAY-}
FB_DIR=${FB_DIR-/tmp/bigchart-fb}
FB_RESOLUTION=${FB_RESOLUTION-1024x768}
FB_PIXEL_DEPTH=${FB_PIXEL_DEPTH-24}

if [[ -n ${DISPLAY} ]]; then
  echo "DISPLAY already set to ${DISPLAY}.  Skipping Xvfb setup."
else
  echo "Setting up Xvfb in ${FB_DIR}"
  Xvfb :1 -screen 0 ${FB_RESOLUTION}x${FB_PIXEL_DEPTH} -fbdir ${FB_DIR} 2>&1 | \
    egrep -v '^(_XSERVTransmkdir.*will not be created\.|Xlib: extension "RANDR" missing on display .*\.)$' &
  export DISPLAY=":1"
fi

exec "$@"

Build Commands

docker rmi ff:11 ff:45 ff:51
docker build --build-arg FIREFOX_VERSION=45 -t ff:45 ./ &&
docker build --build-arg FIREFOX_VERSION=51 -t ff:51 ./ &&
sed -i.orig -E -e 's,^(FROM ubuntu:|ENV UBUNTU_NICKNAME ).*,\1precise,' Dockerfile &&
docker build --build-arg FIREFOX_VERSION=11 -t ff:11 ./
mv Dockerfile.orig Dockerfile

Problem on Linux: Failed to open curl lib from binary, use libcurl.so instead

Hi,

I have problems with this extension on latest Firefox at Linux:
The error: Failed to open curl lib from binary, use libcurl.so instead

Failed to open curl lib from binary, use libcurl.so instead
ExceptionHandler::GenerateDump cloned child 339
ExceptionHandler::SendContinueSignalToChild sent continue signal to child
ExceptionHandler::WaitForContinueSignal waiting for continue signal..

Thanks...

For latest Firefox 60?

Hi
would love to use this, can you update for latest firefox 60 please?
happy to pay a bounty!

Issue with cmdlnprint in OS X

Hello,

I'm excited to use your extension but it doesn't seem to be working properly for me.

When I try it in OS X 10.11.6, Firefox starts up and loads the page, but nothing is printed and the browser window stays open.

Here's the command I'm using:

/Applications/Firefox.app/Contents/MacOS/firefox -print https://google.com -print-mode pdf -print-file /Users/myaccount/test.pdf

I've tried running it with Firefox 49.0.1 and Firefox 45.4.0 but the same thing happens.

I've also tried Ubuntu 14.04 and get almost the same issue.

Can you provide any pointers to help me get this working?

Thank you,

Steve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.