我在码头上安装了一个节点服务器,并且正在使用Libre。它在Windows环境下正常工作,但在Docker环境中,字符被破坏,原因不明。下面是码头文件和破损字母的图片。
FROM node:12-alpine
WORKDIR "/app"
COPY package*.json ./
RUN apk update && apk add libreoffice
# RUN npm install
RUN npm ci --only=production
COPY . .
CMD ["npm", "start"]皈依,
const libre = require(`libreoffice-convert`)
// Read file
const file = fs.readFileSync(enterPath);
// Convert it to pdf format with undefined filter (see Libreoffice doc about filter)
const status = await new Promise((resolve, reject) => {
libre.convert(file, pdfExtend, undefined, (err, done) => {
if (err) {
console.log(err)
reject(err)
}
// Here in done you have pdf file which you can save or transfer in another stream
fs.writeFileSync(outputPath, done);
resolve(200)
});
})结果,


帮帮我
发布于 2020-12-08 06:40:30
我认为阿尔卑斯Linux中缺少字体,现在出现了两个解决方案。(码头图片:节点:12-高山)
image
。
FROM node:12-slimfonts
FROM node:12-alpine
WORKDIR "/app"
COPY package*.json ./
RUN apk update && apk add libreoffice
RUN apk add --no-cache msttcorefonts-installer fontconfig
RUN update-ms-fonts
# Google fonts
RUN wget https://github.com/google/fonts/archive/main.tar.gz -O gf.tar.gz --no-check-certificate
RUN tar -xf gf.tar.gz
RUN mkdir -p /usr/share/fonts/truetype/google-fonts
RUN find $PWD/fonts-main/ -name "*.ttf" -exec install -m644 {} /usr/share/fonts/truetype/google-fonts/ \; || return 1
RUN rm -f gf.tar.gz
RUN fc-cache -f && rm -rf /var/cache/*
# RUN npm install
RUN npm ci --only=production
COPY . .
CMD ["npm", "start"]https://stackoverflow.com/questions/65194122
复制相似问题