带有希伯来语等特殊字符的DOMPDF问题

时间:2019-01-20 11:37:36

标签: utf-8 pdf-generation dompdf

我正在尝试使用希伯来语,但它正在显示???????而不是希伯来语内容。如果有人建议。谢谢

    // Register Action
exports.register = (req, res) => {
  function getAvailableFunds() {
    const availableFunds = 0;
    return availableFunds;
  }

  function getAccountBill() {
    const accountBill = `2222${Math.floor(
      Math.random() * 90000000000000000000,
    ) + 10000000000000000000}`;

    Bill.findOne({
      where: {
        account_bill: accountBill,
      },
    })
      .then(isAccountBill => {
        if (isAccountBill) {
          getAccountBill();
        }
        console.log('accountBill', accountBill);
        return accountBill;
      })
      .catch(err => {
        /* just ignore */
      });
  }

  function getAccountBalanceHistory() {
    const accountBalanceHistory = '0,0';
    return accountBalanceHistory;
  }

  function getTodayDate() {
    const today = new Date();
    return today;
  }

  User.findOne({
    where: { login: req.body.login },
  }).then(isUser => {
    if (!isUser) {
      bcrypt.hash(req.body.password, 10, (err, hash) => {
        req.body.password = hash;

        User.create({
          login: req.body.login,
          password: req.body.password,
          name: req.body.name,
          surname: req.body.surname,
          email: req.body.email,
          date_registration: getTodayDate(),
        })
          .then(user =>
            Bill.create({
              id_owner: user.id,
              account_bill: getAccountBill(), // <- this is null
              available_funds: getAvailableFunds(),
            })
              .then(bill => {
                Additional.create({
                  id_owner: user.id,
                  account_balance_history: getAccountBalanceHistory(),
                })
                  .then(() => {
                    res.status(200).json({ register: true });
                  })
                  .catch(err => {
                    res.status(400).json({ error: err });
                  });
              })
              .catch(err => {
                res.status(400).json({ error: err });
              }),
          )
          .catch(err => {
            res.status(400).json({ error: err });
          });
      });
    } else {
      res.status(400).json({ error: 'User already exists.' });
    }
  });
};

1 个答案:

答案 0 :(得分:0)

字体家族:萤火虫,DejaVu Sans,sans-serif; 在希伯来语包含元素中使用此字体。 祝你好运