add Maximum DPI setting

This commit is contained in:
Ludy87 2025-08-06 18:52:56 +02:00
parent 63b64b5dc5
commit b115fb94d2
No known key found for this signature in database
GPG Key ID: 92696155E0220F94
47 changed files with 77 additions and 3 deletions

View File

@ -311,6 +311,7 @@ public class ApplicationProperties {
private Boolean enableAnalytics;
private Datasource datasource;
private Boolean disableSanitize;
private int maxDPI;
private Boolean enableUrlToPDF;
private Html html = new Html();
private CustomPaths customPaths = new CustomPaths();

View File

@ -35,6 +35,7 @@ import io.github.pixee.security.Filenames;
import lombok.extern.slf4j.Slf4j;
import stirling.software.common.model.ApplicationProperties;
import stirling.software.common.service.CustomPDFDocumentFactory;
@Slf4j
@ -145,13 +146,18 @@ public class PdfUtils {
throws IOException, Exception {
// Validate and limit DPI to prevent excessive memory usage
final int MAX_SAFE_DPI = 500; // Maximum safe DPI to prevent memory issues
if (DPI > MAX_SAFE_DPI) {
int maxSafeDpi = 500; // Default maximum safe DPI
ApplicationProperties properties =
ApplicationContextProvider.getBean(ApplicationProperties.class);
if (properties != null && properties.getSystem() != null) {
maxSafeDpi = properties.getSystem().getMaxDPI();
}
if (DPI > maxSafeDpi) {
throw ExceptionUtils.createIllegalArgumentException(
"error.dpiExceedsLimit",
"DPI value {0} exceeds maximum safe limit of {1}. High DPI values can cause memory issues and crashes. Please use a lower DPI value.",
DPI,
MAX_SAFE_DPI);
maxSafeDpi);
}
try (PDDocument document = pdfDocumentFactory.load(inputStream)) {

View File

@ -8,6 +8,8 @@ import org.springframework.web.servlet.ModelAndView;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.tags.Tag;
import stirling.software.common.model.ApplicationProperties;
import stirling.software.common.util.ApplicationContextProvider;
import stirling.software.common.util.CheckProgramInstall;
@Controller
@ -62,6 +64,13 @@ public class ConverterWebController {
@Hidden
public String pdfToimgForm(Model model) {
boolean isPython = CheckProgramInstall.isPythonAvailable();
ApplicationProperties properties =
ApplicationContextProvider.getBean(ApplicationProperties.class);
if (properties != null && properties.getSystem() != null) {
model.addAttribute("maxDPI", properties.getSystem().getMaxDPI());
} else {
model.addAttribute("maxDPI", 500); // Default value if not set
}
model.addAttribute("isPython", isPython);
model.addAttribute("currentPage", "pdf-to-img");
return "convert/pdf-to-img";

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=نوع اللون
pdfToImage.color=اللون
pdfToImage.grey=تدرج الرمادي
pdfToImage.blackwhite=أبيض وأسود (قد يفقد البيانات!)
pdfToImage.dpi=DPI:
pdfToImage.submit=تحويل
pdfToImage.info=Python غير مثبت. مطلوب لتحويل WebP.
pdfToImage.placeholder=(مثال: 1,2,8 أو 4,7,12-16 أو 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Rəng Tipi
pdfToImage.color=Rəng
pdfToImage.grey=Boz Tonlama
pdfToImage.blackwhite=Qara və Ağ (Data İtə Bilər)
pdfToImage.dpi=DPI:
pdfToImage.submit=Çevir
pdfToImage.info=Python Yüklü Deyil.WebP Çevirməsi Üçün Vacibdir
pdfToImage.placeholder=(məsələn, 1,2,8 və ya 4,7,12-16 və ya 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Тип цвят
pdfToImage.color=Цвят
pdfToImage.grey=Скала на сивото
pdfToImage.blackwhite=Черно и бяло (може да загубите данни!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Преобразуване
pdfToImage.info=Python не е инсталиран. Изисква се за конвертиране на WebP.
pdfToImage.placeholder=(e.g. 1,2,8 or 4,7,12-16 or 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=ཚོས་མདོག་གི་རིགས།
pdfToImage.color=ཚོས་མདོག
pdfToImage.grey=སྐྱ་མདོག
pdfToImage.blackwhite=དཀར་ནག (གནས་ཚུལ་བརླག་སྲིད།)
pdfToImage.dpi=DPI:
pdfToImage.submit=བསྒྱུར་བ།
pdfToImage.info=Python སྒྲིག་འཇུག་བྱས་མི་འདུག WebP བསྒྱུར་བར་དགོས་མཁོ་ཡིན།
pdfToImage.placeholder=(དཔེར་ན། 1,2,8 ཡང་ན་ 4,7,12-16 ཡང་ན་ 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Tipus de Color
pdfToImage.color=Color
pdfToImage.grey=Escala de Grisos
pdfToImage.blackwhite=Blanc i Negre (Pot perdre dades!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Converteix
pdfToImage.info=Python no està instal·lat. És necessari per a la conversió a WebP.
pdfToImage.placeholder=(p. ex. 1,2,8 o 4,7,12-16 o 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Typ barev
pdfToImage.color=Barevný
pdfToImage.grey=Stupně šedi
pdfToImage.blackwhite=Černobílý (Může dojít ke ztrátě dat!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Převést
pdfToImage.info=Python není nainstalován. Vyžadován pro konverzi do WebP.
pdfToImage.placeholder=(např. 1,2,8 nebo 4,7,12-16 nebo 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Farvetype
pdfToImage.color=Farve
pdfToImage.grey=Gråtone
pdfToImage.blackwhite=Sort og Hvid (Kan miste data!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konvertér
pdfToImage.info=Python er ikke installeret. Påkrævet for WebP-konvertering.
pdfToImage.placeholder=(f.eks. 1,2,8 eller 4,7,12-16 eller 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Farbtyp
pdfToImage.color=Farbe
pdfToImage.grey=Graustufen
pdfToImage.blackwhite=Schwarzweiß (Datenverlust möglich!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Umwandeln
pdfToImage.info=Python ist nicht installiert. Erforderlich für die WebP-Konvertierung.
pdfToImage.placeholder=(z.B. 1,2,8 oder 4,7,12-16 oder 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Τύπος χρώματος
pdfToImage.color=Έγχρωμο
pdfToImage.grey=Κλίμακα του γκρι
pdfToImage.blackwhite=Ασπρόμαυρο (Μπορεί να χαθούν δεδομένα!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Μετατροπή
pdfToImage.info=Η Python δεν είναι εγκατεστημένη. Απαιτείται για μετατροπή WebP.
pdfToImage.placeholder=(π.χ. 1,2,8 ή 4,7,12-16 ή 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Colour type
pdfToImage.color=Colour
pdfToImage.grey=Greyscale
pdfToImage.blackwhite=Black and White (May lose data!)
pdfToImage.dpi=DPI (The server limit is {0} dpi)
pdfToImage.submit=Convert
pdfToImage.info=Python is not installed. Required for WebP conversion.
pdfToImage.placeholder=(e.g. 1,2,8 or 4,7,12-16 or 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Color type
pdfToImage.color=Color
pdfToImage.grey=Grayscale
pdfToImage.blackwhite=Black and White (May lose data!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Convert
pdfToImage.info=Python is not installed. Required for WebP conversion.
pdfToImage.placeholder=(e.g. 1,2,8 or 4,7,12-16 or 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Tipo de color
pdfToImage.color=Color
pdfToImage.grey=Escala de grises
pdfToImage.blackwhite=Blanco y Negro (¡Puede perder datos!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Convertir
pdfToImage.info=Python no está instalado. Se requiere para la conversión WebP.
pdfToImage.placeholder=(por ejemplo 1,2,8 o 4,7,12-16 o 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Kolore-mota
pdfToImage.color=Kolorea
pdfToImage.grey=Gris-eskala
pdfToImage.blackwhite=Zuria eta Beltza (Datuak galdu ditzake!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Bihurtu
pdfToImage.info=Python is not installed. Required for WebP conversion.
pdfToImage.placeholder=(e.g. 1,2,8 or 4,7,12-16 or 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=نوع رنگ
pdfToImage.color=رنگ
pdfToImage.grey=خاکستری
pdfToImage.blackwhite=سیاه و سفید (ممکن است اطلاعات از دست برود!)
pdfToImage.dpi=DPI:
pdfToImage.submit=تبدیل
pdfToImage.info=پایتون نصب نشده است. برای تبدیل WebP لازم است.
pdfToImage.placeholder=(مثال: 1,2,8 یا 4,7,12-16 یا 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Type d'impression
pdfToImage.color=Couleur
pdfToImage.grey=Niveaux de gris
pdfToImage.blackwhite=Noir et blanc (peut engendrer une perte de données !)
pdfToImage.dpi=DPI:
pdfToImage.submit=Convertir
pdfToImage.info=Python n'est pas installé. Nécessaire pour la conversion WebP.
pdfToImage.placeholder=(par exemple : 1,2,8 ou 4,7,12-16 ou 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Cineál dath
pdfToImage.color=Dath
pdfToImage.grey=Scála Liath
pdfToImage.blackwhite=Dubh agus Bán (Dfhéadfadh sonraí a chailleadh!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Tiontaigh
pdfToImage.info=Níl Python suiteáilte. Ag teastáil le haghaidh comhshó WebP.
pdfToImage.placeholder=(m.sh. 1,2,8 nó 4,7,12-16 nó 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=रंग प्रकार
pdfToImage.color=रंग
pdfToImage.grey=ग्रेस्केल
pdfToImage.blackwhite=काला और सफेद (डेटा खो सकता है!)
pdfToImage.dpi=DPI:
pdfToImage.submit=बदलें
pdfToImage.info=Python स्थापित नहीं है। WebP रूपांतरण के लिए आवश्यक है।
pdfToImage.placeholder=(जैसे 1,2,8 या 4,7,12-16 या 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Tip boje
pdfToImage.color=Boja
pdfToImage.grey=Sivi tonovi
pdfToImage.blackwhite=Crno-bijelo (mogu se izgubiti podaci!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Pretvori
pdfToImage.info=Python nije instaliran. Treba je za konverziju na WebP.
pdfToImage.placeholder=(t.j. 1,2,8 ili 4,7,12-16 ili 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Színtípus
pdfToImage.color=Színes
pdfToImage.grey=Szürkeárnyalatos
pdfToImage.blackwhite=Fekete-fehér (adatvesztéssel járhat!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konvertálás
pdfToImage.info=Python nincs telepítve. WebP konverzióhoz szükséges.
pdfToImage.placeholder=(pl. 1,2,8 vagy 4,7,12-16 vagy 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Tipe warna
pdfToImage.color=Warna
pdfToImage.grey=Skala abu-abu
pdfToImage.blackwhite=Black and White (Bisa kehilangan data!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konversi
pdfToImage.info=Python tidak terinstal. Diperlukan untuk konversi WebP.
pdfToImage.placeholder=(misalnya 1,2,8 atau 4,7,12-16 atau 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Tipo di colore
pdfToImage.color=A colori
pdfToImage.grey=Scala di grigi
pdfToImage.blackwhite=Bianco e Nero (potresti perdere dettagli!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Converti
pdfToImage.info=Python non è installato.È richiesto per la conversione WebP.
pdfToImage.placeholder=(es. 1,2,8 o 4,7,12-16 o 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=カラーモード
pdfToImage.color=カラー
pdfToImage.grey=グレースケール
pdfToImage.blackwhite=白黒(データが失われる可能性があります!)
pdfToImage.dpi=DPI:
pdfToImage.submit=変換
pdfToImage.info=Pythonがインストールされていません。WebPの変換に必要です。
pdfToImage.placeholder=(例:1,2,8、4,7,12-16、2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=색상 유형
pdfToImage.color=컬러
pdfToImage.grey=그레이스케일
pdfToImage.blackwhite=흑백 (데이터 손실 가능성 있음!)
pdfToImage.dpi=DPI:
pdfToImage.submit=변환
pdfToImage.info=WebP 변환에는 Python이 필요합니다. Python이 설치되지 않았습니다.
pdfToImage.placeholder=(예: 1,2,8 또는 4,7,12-16 또는 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=നിറ തരം
pdfToImage.color=നിറം
pdfToImage.grey=ഗ്രേസ്കെയിൽ
pdfToImage.blackwhite=കറുപ്പും വെളുപ്പും (ഡാറ്റ നഷ്ടപ്പെട്ടേക്കാം!)
pdfToImage.dpi=DPI:
pdfToImage.submit=പരിവർത്തനം ചെയ്യുക
pdfToImage.info=പൈത്തൺ ഇൻസ്റ്റാൾ ചെയ്തിട്ടില്ല. WebP പരിവർത്തനത്തിന് ആവശ്യമാണ്.
pdfToImage.placeholder=(ഉദാ. 1,2,8 അല്ലെങ്കിൽ 4,7,12-16 അല്ലെങ്കിൽ 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Kleurtype
pdfToImage.color=Kleur
pdfToImage.grey=Grijstinten
pdfToImage.blackwhite=Zwart en wit (kan data verliezen!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Omzetten
pdfToImage.info=Python is niet geïnstalleerd. Vereist voor WebP-conversie.
pdfToImage.placeholder=(bijv. 1,2,8 of 4,7,12-16 of 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Farge type
pdfToImage.color=Farge
pdfToImage.grey=Gråtone
pdfToImage.blackwhite=Svart-hvitt (kan miste data!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konverter
pdfToImage.info=Python is not installed. Required for WebP conversion.
pdfToImage.placeholder=(f.eks. 1,2,8 eller 4,7,12-16 eller 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Rodzaj koloru
pdfToImage.color=Kolor
pdfToImage.grey=Odcień szarości
pdfToImage.blackwhite=Czarno-biały (może spowodować utratę danych!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konwertuj
pdfToImage.info=Python nie został zainstalowany. Jest wymagany do konwersji WebP.
pdfToImage.placeholder=(przykład 1,2,8 lub 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Cor de saída:
pdfToImage.color=Colorido
pdfToImage.grey=Escala de Cinza
pdfToImage.blackwhite=Preto e Branco (pode perder informações!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Converter
pdfToImage.info=Python não está instalado. Necessário para conversão WebP.
pdfToImage.placeholder=(por exemplo 1,2,8 ou 4,7,12-16 ou 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Tipo de cor
pdfToImage.color=Cor
pdfToImage.grey=Escala de Cinza
pdfToImage.blackwhite=Preto e Branco (Pode perder dados!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Converter
pdfToImage.info=Python não está instalado. Necessário para conversão WebP.
pdfToImage.placeholder=(ex. 1,2,8 ou 4,7,12-16 ou 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Tip culoare
pdfToImage.color=Culoare
pdfToImage.grey=Scală de gri
pdfToImage.blackwhite=Alb și negru (Poate pierde date!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Convertește
pdfToImage.info=Python nu este instalat. Necesar pentru conversia WebP.
pdfToImage.placeholder=(ex. 1,2,8 sau 4,7,12-16 sau 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Тип цвета
pdfToImage.color=Цветной
pdfToImage.grey=Оттенки серого
pdfToImage.blackwhite=Черно-белый (возможна потеря данных!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Преобразовать
pdfToImage.info=Python не установлен. Требуется для конвертации в WebP.
pdfToImage.placeholder=(например, 1,2,8 или 4,7,12-16 или 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Typ farby
pdfToImage.color=Farba
pdfToImage.grey=Odtiene šedej
pdfToImage.blackwhite=Čierno-biele (Môže stratiť údaje!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konvertovať
pdfToImage.info=Python is not installed. Required for WebP conversion.
pdfToImage.placeholder=(napr. 1,2,8 alebo 4,7,12-16 alebo 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Vrsta barve
pdfToImage.color=Barva
pdfToImage.grey=Sivine
pdfToImage.blackwhite=Črno-belo (Lahko izgubite podatke!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Pretvori
pdfToImage.info=Python ni nameščen. Zahtevano za pretvorbo WebP.
pdfToImage.placeholder=(npr. 1,2,8 ali 4,7,12-16 ali 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Režim boja:
pdfToImage.color=Kolor
pdfToImage.grey=Monohromatski
pdfToImage.blackwhite=Crno-belo (Može izgubiti detalje!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konvertuj
pdfToImage.info=Python nije instaliran. Neophodan je za WebP konverziju.
pdfToImage.placeholder=(npr. 1,2,8 ili 4,7,12-16 ili 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Färgtyp
pdfToImage.color=Färg
pdfToImage.grey=Gråskala
pdfToImage.blackwhite=Svartvitt (kan förlora data!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Konvertera
pdfToImage.info=Python är inte installerat. Krävs för WebP-konvertering.
pdfToImage.placeholder=(t.ex. 1,2,8 eller 4,7,12-16 eller 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=ประเภทสี
pdfToImage.color=สี
pdfToImage.grey=ระดับสีเทา
pdfToImage.blackwhite=ขาวดำ (อาจสูญเสียข้อมูล!)
pdfToImage.dpi=DPI:
pdfToImage.submit=แปลง
pdfToImage.info=Python ไม่มีการติดตั้ง จำเป็นสำหรับการแปลง WebP
pdfToImage.placeholder=(เช่น 1,2,8 หรือ 4,7,12-16 หรือ 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Renk türü
pdfToImage.color=Renk
pdfToImage.grey=Gri tonlama
pdfToImage.blackwhite=Siyah ve Beyaz (Veri kaybolabilir!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Dönüştür
pdfToImage.info=Python kurulu değil. WebP dönüşümü için gereklidir.
pdfToImage.placeholder=(örneğin 1,2,8 veya 4,7,12-16 ya da 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Тип кольору
pdfToImage.color=Колір
pdfToImage.grey=Відтінки сірого
pdfToImage.blackwhite=Чорно-білий (може втратити дані!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Конвертувати
pdfToImage.info=Python не встановлено. Необхідно для конвертації WebP.
pdfToImage.placeholder=(наприклад 1,2,8 або 4,7,12-16 або 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=Loại màu
pdfToImage.color=Màu
pdfToImage.grey=Thang độ xám
pdfToImage.blackwhite=Đen trắng (Có thể mất dữ liệu!)
pdfToImage.dpi=DPI:
pdfToImage.submit=Chuyển đổi
pdfToImage.info=Python is not installed. Required for WebP conversion.
pdfToImage.placeholder=(ví dụ: 1,2,8 hoặc 4,7,12-16 hoặc 2n-1)

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=颜色类型
pdfToImage.color=颜色
pdfToImage.grey=灰度
pdfToImage.blackwhite=黑白(可能会丢失数据!)。
pdfToImage.dpi=DPI:
pdfToImage.submit=转换
pdfToImage.info=WebP 转换需要安装 Python
pdfToImage.placeholder=例如1,2,8 或 4,7,12-16 或 2n-1

View File

@ -1402,6 +1402,7 @@ pdfToImage.colorType=顏色類型
pdfToImage.color=顏色
pdfToImage.grey=灰度
pdfToImage.blackwhite=黑白(可能會遺失資料!)
pdfToImage.dpi=DPI:
pdfToImage.submit=轉換
pdfToImage.info=尚未安裝 Python。需要安裝 Python 才能進行 WebP 轉換。
pdfToImage.placeholder=(例如 1,2,8 或 4,7,12-16 或 2n-1

View File

@ -108,6 +108,7 @@ system:
enableAnalytics: null # set to 'true' to enable analytics, set to 'false' to disable analytics; for enterprise users, this is set to true
enableUrlToPDF: false # Set to 'true' to enable URL to PDF, INTERNAL ONLY, known security issues, should not be used externally
disableSanitize: false # set to true to disable Sanitize HTML; (can lead to injections in HTML)
maxDPI: 500 # Maximum allowed DPI for PDF to image conversion
html:
urlSecurity:
enabled: true # Enable URL security restrictions for HTML processing

View File

@ -4,6 +4,21 @@
<head>
<th:block th:insert="~{fragments/common :: head(title=#{pdfToImage.title}, header=#{pdfToImage.header})}"></th:block>
<script th:inline="javascript">
document.addEventListener("DOMContentLoaded", function () {
const maxDPI = /*[[${maxDPI}]]*/ 500; // Maximum DPI for PDF to image conversion
const maxDPILabelRaw = /*[[#{pdfToImage.dpi}]]*/ "DPI (The server limit is {0} dpi)"; // Maximum DPI for PDF to image conversion
const maxDPILabel = maxDPILabelRaw.replace("{0}", maxDPI); // Replace with actual value from properties
const dpilabel = document.querySelector('label[for="dpi"]');
if (dpilabel) {
dpilabel.textContent = maxDPILabel;
}
const maxDPIInput = document.getElementById("dpi");
if (maxDPIInput) {
maxDPIInput.setAttribute("max", maxDPI); // Set the maximum value for DPI input
}
});
</script>
</head>
<body>

View File

@ -295,6 +295,7 @@ Stirling-PDF can be customized through environment variables or a `settings.yml`
- Security settings
- UI customization
- Endpoint management
- Maximum DPI for PDF to image conversion (`system.maxDPI`)
When using Docker, pass environment variables using the `-e` flag or in your `docker-compose.yml` file.