feat: change to xelatex

This commit is contained in:
C4illin
2024-06-27 23:26:46 +02:00
parent 10d20a8786
commit fae2ba9c54
5 changed files with 16 additions and 9 deletions

View File

@@ -34,6 +34,7 @@ LABEL repo="https://github.com/C4illin/ConvertX"
RUN apk --no-cache add \
pandoc \
texlive \
texlive-xetex \
texmf-dist-latexextra \
ffmpeg \
graphicsmagick \

View File

@@ -21,7 +21,7 @@ A self-hosted online file converter. Supports 831 different formats. Written wit
|------------------------------------------------------------------------------|---------------|---------------|-------------|
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
| [PDFLaTeX](https://www.math.rug.nl/~trentelman/jacob/pdflatex/pdflatex.html) | Documents | 1 | 1 |
| [XeLaTeX](https://tug.org/xetex/) | Documents | 1 | 1 |
| [Pandoc](https://pandoc.org/) | Documents | 43 | 65 |
| [GraphicsMagick](http://www.graphicsmagick.org/) | Images | 166 | 133 |
| [FFmpeg](https://ffmpeg.org/) | Video | ~473 | ~280 |

View File

@@ -16,9 +16,9 @@ import {
} from "./graphicsmagick";
import {
convert as convertPdflatex,
properties as propertiesPdflatex,
} from "./pdflatex";
convert as convertxelatex,
properties as propertiesxelatex,
} from "./xelatex";
import {
convert as convertLibjxl,
@@ -63,9 +63,9 @@ const properties: {
properties: propertiesImage,
converter: convertImage,
},
pdflatex: {
properties: propertiesPdflatex,
converter: convertPdflatex,
xelatex: {
properties: propertiesxelatex,
converter: convertxelatex,
},
pandoc: {
properties: propertiesPandoc,

View File

@@ -127,9 +127,15 @@ export function convert(
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
options?: any,
): Promise<string> {
// set xelatex here
const xelatex = ["pdf", "latex"];
let option = "";
if (xelatex.includes(convertTo)) {
option = "--pdf-engine=xelatex";
}
return new Promise((resolve, reject) => {
exec(
`pandoc "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
`pandoc ${option} "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);

View File

@@ -25,7 +25,7 @@ export function convert(
.join("/")
.replace("./", "");
exec(
`pdflatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
`latexmk -xelatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);