fix: pdf support in vips
This commit is contained in:
parent
1535377bfe
commit
8ca4f1587d
2 changed files with 22 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
FROM oven/bun:1.1.25-alpine as base
|
FROM oven/bun:1.1.25-alpine AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# install dependencies into temp directory
|
# install dependencies into temp directory
|
||||||
|
|
@ -40,6 +40,8 @@ RUN apk --no-cache add \
|
||||||
graphicsmagick \
|
graphicsmagick \
|
||||||
ghostscript \
|
ghostscript \
|
||||||
vips-tools \
|
vips-tools \
|
||||||
|
vips-poppler \
|
||||||
|
vips-jxl \
|
||||||
libjxl-tools
|
libjxl-tools
|
||||||
|
|
||||||
# this might be needed for some latex use cases, will add it if needed.
|
# this might be needed for some latex use cases, will add it if needed.
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,15 @@ export function convert(
|
||||||
// .toFormat(convertTo)
|
// .toFormat(convertTo)
|
||||||
// .toFile(targetPath);
|
// .toFile(targetPath);
|
||||||
// }
|
// }
|
||||||
|
let action = "copy";
|
||||||
|
if (fileType === "pdf") {
|
||||||
|
action = "pdfload";
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec(`vips copy "${filePath}" "${targetPath}"`, (error, stdout, stderr) => {
|
exec(
|
||||||
|
`vips ${action} "${filePath}" "${targetPath}"`,
|
||||||
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(`error: ${error}`);
|
reject(`error: ${error}`);
|
||||||
}
|
}
|
||||||
|
|
@ -129,6 +135,7 @@ export function convert(
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve("success");
|
resolve("success");
|
||||||
});
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue