mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-10-23 04:52:18 +00:00
fix: pdf support in vips
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM oven/bun:1.1.25-alpine as base
|
||||
FROM oven/bun:1.1.25-alpine AS base
|
||||
WORKDIR /app
|
||||
|
||||
# install dependencies into temp directory
|
||||
@@ -40,6 +40,8 @@ RUN apk --no-cache add \
|
||||
graphicsmagick \
|
||||
ghostscript \
|
||||
vips-tools \
|
||||
vips-poppler \
|
||||
vips-jxl \
|
||||
libjxl-tools
|
||||
|
||||
# this might be needed for some latex use cases, will add it if needed.
|
||||
|
@@ -113,22 +113,29 @@ export function convert(
|
||||
// .toFormat(convertTo)
|
||||
// .toFile(targetPath);
|
||||
// }
|
||||
let action = "copy";
|
||||
if (fileType === "pdf") {
|
||||
action = "pdfload";
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(`vips copy "${filePath}" "${targetPath}"`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(`error: ${error}`);
|
||||
}
|
||||
exec(
|
||||
`vips ${action} "${filePath}" "${targetPath}"`,
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(`error: ${error}`);
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
console.log(`stdout: ${stdout}`);
|
||||
}
|
||||
if (stdout) {
|
||||
console.log(`stdout: ${stdout}`);
|
||||
}
|
||||
|
||||
if (stderr) {
|
||||
console.error(`stderr: ${stderr}`);
|
||||
}
|
||||
if (stderr) {
|
||||
console.error(`stderr: ${stderr}`);
|
||||
}
|
||||
|
||||
resolve("success");
|
||||
});
|
||||
resolve("success");
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user