artiebits / pdf-to-printer

Print PDFs and images from Node.js and Electron

Home Page:https://artiebits.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Platform not supported error in linux

alpfreda opened this issue · comments

Platform not supported occurred in v5.0.0 when running code on linux

But its work perfectly in the v3.0.0

big thanks

Hi @alpfreda, the package no longer supports Linux and other Unix-like operating systems, the functionality moved to a new package https://github.com/artiebits/unix-print.
You can check the release notes https://github.com/artiebits/pdf-to-printer/releases/tag/v4.0.0.
Sorry for the inconvenience!

@artiebits Thanks for your reply.
Our customers used the app on both platforms (linux & win)
what are your suggestions?

i guess something like this

import os from "os";
import { print as printForWindows } from "pdf-to-printer";
import { print as printForUnix } from "unix-print";

export default function print({ file, optionsForWindows, optionsForUnix }) {
  if (os.platform() === "win32") {
    printForWindows(file, optionsForWindows);
  } else {
    printForUnix(file, optionsForUnix);
  }
}

thanks.