尝试使用phantom-html2pdf nodejs将html转换为pdf . 除了一个之外,所有工作都没有问题 . 我尝试将CSS应用于我的输出,但根本没有任何事情发生 .

app.get("/ph2p", function(req, res) {
  var pdf = require("phantom-html2pdf");

  var fs = require("fs");

  fs.unlink("./file.pdf", function() {
    console.log("pdf file deleted!");
  });

  pdf.convert(
    {
      'html': "htmlfile.html",
      'css': "style.css",
      js: "",
      runnings: "",
      'paperSize': { format: "A4", orientation: "portrait", border: "1cm" },
      deleteOnAction: true,
      runningsArgs: ""
    },
    function(err, result) {
      result.toFile("file.pdf", function() {
        console.log("pdf file created");
      });
    }
  );

  res.end("pdf checking...");
});

谁有线索有什么不对?