From e69ed06b4f3b1169cae8bef0b6252dcdb7ff1e6e Mon Sep 17 00:00:00 2001 From: cloud-erik <67910530+cloud-erik@users.noreply.github.com> Date: Sun, 14 Jan 2024 10:29:21 +0100 Subject: [PATCH 01/90] Update docker-compose-latest.yml Exemple DEFAULTLOCALE formating --- exampleYmlFiles/docker-compose-latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleYmlFiles/docker-compose-latest.yml b/exampleYmlFiles/docker-compose-latest.yml index a9dc1f31..d506e424 100644 --- a/exampleYmlFiles/docker-compose-latest.yml +++ b/exampleYmlFiles/docker-compose-latest.yml @@ -21,7 +21,7 @@ services: environment: DOCKER_ENABLE_SECURITY: "false" SECURITY_ENABLELOGIN: "false" - SYSTEM_DEFAULTLOCALE: en_US + SYSTEM_DEFAULTLOCALE: en-US UI_APPNAME: Stirling-PDF UI_HOMEDESCRIPTION: Demo site for Stirling-PDF Latest UI_APPNAMENAVBAR: Stirling-PDF Latest From 490acddc6569ba3688c03ad4832ed36e562d3a23 Mon Sep 17 00:00:00 2001 From: cloud-erik <67910530+cloud-erik@users.noreply.github.com> Date: Sun, 14 Jan 2024 10:31:45 +0100 Subject: [PATCH 02/90] Update docker-compose-latest-ultra-lite.yml Exemple DEFAULTLOCALE formating --- exampleYmlFiles/docker-compose-latest-ultra-lite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleYmlFiles/docker-compose-latest-ultra-lite.yml b/exampleYmlFiles/docker-compose-latest-ultra-lite.yml index 31fec67b..710c0072 100644 --- a/exampleYmlFiles/docker-compose-latest-ultra-lite.yml +++ b/exampleYmlFiles/docker-compose-latest-ultra-lite.yml @@ -20,7 +20,7 @@ services: environment: DOCKER_ENABLE_SECURITY: "false" SECURITY_ENABLELOGIN: "false" - SYSTEM_DEFAULTLOCALE: en_US + SYSTEM_DEFAULTLOCALE: en-US UI_APPNAME: Stirling-PDF-Ultra-lite UI_HOMEDESCRIPTION: Demo site for Stirling-PDF-Ultra-lite Latest UI_APPNAMENAVBAR: Stirling-PDF-Ultra-lite Latest From 1b83fda3494d19d4b1a5b0613367d0a1cf5e3f3b Mon Sep 17 00:00:00 2001 From: cloud-erik <67910530+cloud-erik@users.noreply.github.com> Date: Sun, 14 Jan 2024 10:32:00 +0100 Subject: [PATCH 03/90] Update docker-compose-latest-ultra-lite-security.yml Exemple DEFAULTLOCALE formating --- exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml b/exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml index 7971eeb7..b7848696 100644 --- a/exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml +++ b/exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml @@ -21,7 +21,7 @@ services: environment: DOCKER_ENABLE_SECURITY: "true" SECURITY_ENABLELOGIN: "true" - SYSTEM_DEFAULTLOCALE: en_US + SYSTEM_DEFAULTLOCALE: en-US UI_APPNAME: Stirling-PDF-Lite UI_HOMEDESCRIPTION: Demo site for Stirling-PDF-Lite Latest with Security UI_APPNAMENAVBAR: Stirling-PDF-Lite Latest From 219dd7834f9293fdad46d82c0f460ca2f811f4a2 Mon Sep 17 00:00:00 2001 From: cloud-erik <67910530+cloud-erik@users.noreply.github.com> Date: Sun, 14 Jan 2024 10:32:12 +0100 Subject: [PATCH 04/90] Update docker-compose-latest-security.yml Exemple DEFAULTLOCALE formating --- exampleYmlFiles/docker-compose-latest-security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleYmlFiles/docker-compose-latest-security.yml b/exampleYmlFiles/docker-compose-latest-security.yml index 807a755e..513bb582 100644 --- a/exampleYmlFiles/docker-compose-latest-security.yml +++ b/exampleYmlFiles/docker-compose-latest-security.yml @@ -21,7 +21,7 @@ services: environment: DOCKER_ENABLE_SECURITY: "true" SECURITY_ENABLELOGIN: "true" - SYSTEM_DEFAULTLOCALE: en_US + SYSTEM_DEFAULTLOCALE: en-US UI_APPNAME: Stirling-PDF UI_HOMEDESCRIPTION: Demo site for Stirling-PDF Latest with Security UI_APPNAMENAVBAR: Stirling-PDF Latest From 686af16cf5620ab56d63352069247362df1a81af Mon Sep 17 00:00:00 2001 From: cloud-erik <67910530+cloud-erik@users.noreply.github.com> Date: Sun, 14 Jan 2024 10:32:23 +0100 Subject: [PATCH 05/90] Update docker-compose-latest-lite.yml Exemple DEFAULTLOCALE formating --- exampleYmlFiles/docker-compose-latest-lite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleYmlFiles/docker-compose-latest-lite.yml b/exampleYmlFiles/docker-compose-latest-lite.yml index 7b374688..e40f873d 100644 --- a/exampleYmlFiles/docker-compose-latest-lite.yml +++ b/exampleYmlFiles/docker-compose-latest-lite.yml @@ -20,7 +20,7 @@ services: environment: DOCKER_ENABLE_SECURITY: "false" SECURITY_ENABLELOGIN: "false" - SYSTEM_DEFAULTLOCALE: en_US + SYSTEM_DEFAULTLOCALE: en-US UI_APPNAME: Stirling-PDF-Lite UI_HOMEDESCRIPTION: Demo site for Stirling-PDF-Lite Latest UI_APPNAMENAVBAR: Stirling-PDF-Lite Latest From c807d20590effdd70abcb64bf3ed8ec1a360aa47 Mon Sep 17 00:00:00 2001 From: cloud-erik <67910530+cloud-erik@users.noreply.github.com> Date: Sun, 14 Jan 2024 10:32:34 +0100 Subject: [PATCH 06/90] Update docker-compose-latest-lite-security.yml Exemple DEFAULTLOCALE formating --- exampleYmlFiles/docker-compose-latest-lite-security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleYmlFiles/docker-compose-latest-lite-security.yml b/exampleYmlFiles/docker-compose-latest-lite-security.yml index 41dc4567..90e4c5bf 100644 --- a/exampleYmlFiles/docker-compose-latest-lite-security.yml +++ b/exampleYmlFiles/docker-compose-latest-lite-security.yml @@ -21,7 +21,7 @@ services: environment: DOCKER_ENABLE_SECURITY: "true" SECURITY_ENABLELOGIN: "true" - SYSTEM_DEFAULTLOCALE: en_US + SYSTEM_DEFAULTLOCALE: en-US UI_APPNAME: Stirling-PDF-Lite UI_HOMEDESCRIPTION: Demo site for Stirling-PDF-Lite Latest with Security UI_APPNAMENAVBAR: Stirling-PDF-Lite Latest From 89c0e721b8ccd633f6abd5e16ea202355fee5e89 Mon Sep 17 00:00:00 2001 From: Stirling-PDF-Bot Date: Mon, 15 Jan 2024 00:13:30 +0000 Subject: [PATCH 07/90] Update 3rd Party Licenses --- .../resources/static/3rdPartyLicenses.json | 78 +++++++++++++++++-- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/src/main/resources/static/3rdPartyLicenses.json b/src/main/resources/static/3rdPartyLicenses.json index 88263b1d..699be591 100644 --- a/src/main/resources/static/3rdPartyLicenses.json +++ b/src/main/resources/static/3rdPartyLicenses.json @@ -357,22 +357,29 @@ { "moduleName": "org.apache.pdfbox:fontbox", "moduleUrl": "https://pdfbox.apache.org", - "moduleVersion": "2.0.30", - "moduleLicense": "Apache License, Version 2.0", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "org.apache.pdfbox:pdfbox", "moduleUrl": "https://pdfbox.apache.org", - "moduleVersion": "2.0.30", - "moduleLicense": "Apache License, Version 2.0", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" + }, + { + "moduleName": "org.apache.pdfbox:pdfbox-io", + "moduleUrl": "https://pdfbox.apache.org", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "org.apache.pdfbox:xmpbox", "moduleUrl": "https://pdfbox.apache.org", - "moduleVersion": "2.0.30", - "moduleLicense": "Apache License, Version 2.0", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" }, { @@ -450,6 +457,12 @@ "moduleLicense": "BSD 2-Clause License", "moduleLicenseUrl": "https://opensource.org/licenses/BSD-2-Clause" }, + { + "moduleName": "org.commonmark:commonmark-ext-gfm-tables", + "moduleVersion": "0.21.0", + "moduleLicense": "BSD 2-Clause License", + "moduleLicenseUrl": "https://opensource.org/licenses/BSD-2-Clause" + }, { "moduleName": "org.eclipse.angus:angus-activation", "moduleUrl": "https://www.eclipse.org", @@ -506,6 +519,52 @@ "moduleLicense": "Public Domain", "moduleLicenseUrl": "http://repository.jboss.org/licenses/cc0-1.0.txt" }, + { + "moduleName": "org.junit.jupiter:junit-jupiter", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.jupiter:junit-jupiter-api", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.jupiter:junit-jupiter-engine", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.jupiter:junit-jupiter-params", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.platform:junit-platform-commons", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "1.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.platform:junit-platform-engine", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "1.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit:junit-bom", + "moduleVersion": "5.10.1" + }, { "moduleName": "org.latencyutils:LatencyUtils", "moduleUrl": "http://latencyutils.github.io/LatencyUtils/", @@ -513,6 +572,13 @@ "moduleLicense": "Public Domain, per Creative Commons CC0", "moduleLicenseUrl": "http://creativecommons.org/publicdomain/zero/1.0/" }, + { + "moduleName": "org.opentest4j:opentest4j", + "moduleUrl": "https://github.com/ota4j-team/opentest4j", + "moduleVersion": "1.3.0", + "moduleLicense": "The Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" + }, { "moduleName": "org.slf4j:jul-to-slf4j", "moduleUrl": "http://www.slf4j.org", From ec5a3c59481b3272bc4ca887bca53c91510dad46 Mon Sep 17 00:00:00 2001 From: tkymmm <136296842+tkymmm@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:16:46 +0900 Subject: [PATCH 08/90] Update messages_ja_JP.properties Updated Japanese translation. --- src/main/resources/messages_ja_JP.properties | 125 +++++++++---------- 1 file changed, 62 insertions(+), 63 deletions(-) diff --git a/src/main/resources/messages_ja_JP.properties b/src/main/resources/messages_ja_JP.properties index 7ba8b206..7600209e 100644 --- a/src/main/resources/messages_ja_JP.properties +++ b/src/main/resources/messages_ja_JP.properties @@ -55,23 +55,23 @@ usernameExistsMessage=新しいユーザー名はすでに存在します。 ############### # Pipeline # ############### -pipeline.header=Pipeline Menu (Alpha) +pipeline.header=パイプラインメニュー (Alpha) pipeline.uploadButton=Upload Custom -pipeline.configureButton=Configure -pipeline.defaultOption=Custom -pipeline.submitButton=Submit +pipeline.configureButton=設定 +pipeline.defaultOption=カスタム +pipeline.submitButton=送信 ###################### # Pipeline Options # ###################### -pipelineOptions.header=Pipeline Configuration -pipelineOptions.pipelineNameLabel=Pipeline Name -pipelineOptions.saveSettings=Save Operation Settings -pipelineOptions.pipelineNamePrompt=Enter pipeline name here -pipelineOptions.addOperationButton=Add operation -pipelineOptions.pipelineHeader=Pipeline: -pipelineOptions.saveButton=Download -pipelineOptions.validateButton=Validate +pipelineOptions.header=パイプライン設定 +pipelineOptions.pipelineNameLabel=パイプライン名 +pipelineOptions.saveSettings=動作設定の保存 +pipelineOptions.pipelineNamePrompt=ここにパイプライン名を入力 +pipelineOptions.addOperationButton=動作の追加 +pipelineOptions.pipelineHeader=パイプライン: +pipelineOptions.saveButton=ダウンロード +pipelineOptions.validateButton=検証 @@ -281,8 +281,8 @@ home.removeBlanks.title=空白ページの削除 home.removeBlanks.desc=ドキュメントから空白ページを検出して削除します。 removeBlanks.tags=cleanup,streamline,non-content,organize -home.removeAnnotations.title=Remove Annotations -home.removeAnnotations.desc=Removes all comments/annotations from a PDF +home.removeAnnotations.title=注釈の削除 +home.removeAnnotations.desc=PDFからすべてのコメント・注釈を削除します。 removeAnnotations.tags=comments,highlight,notes,markup,remove home.compare.title=比較 @@ -366,22 +366,22 @@ home.autoRedact.title=自動塗りつぶし home.autoRedact.desc=入力したテキストに基づいてPDF内のテキストを自動で塗りつぶし(黒塗り)します。 showJS.tags=JS -home.tableExtraxt.title=PDF to CSV -home.tableExtraxt.desc=Extracts Tables from a PDF converting it to CSV +home.tableExtraxt.title=PDFをCSVに変換 +home.tableExtraxt.desc=PDFから表を抽出しCSVに変換します。 tableExtraxt.tags=CSV,Table Extraction,extract,convert -home.autoSizeSplitPDF.title=Auto Split by Size/Count -home.autoSizeSplitPDF.desc=Split a single PDF into multiple documents based on size, page count, or document count +home.autoSizeSplitPDF.title=サイズ・数による自動分割 +home.autoSizeSplitPDF.desc=サイズ・ページ数またはドキュメント数に基づいて、1つのPDFを複数のドキュメントに分割します。 autoSizeSplitPDF.tags=pdf,split,document,organization -home.overlay-pdfs.title=Overlay PDFs -home.overlay-pdfs.desc=Overlays PDFs on-top of another PDF +home.overlay-pdfs.title=PDFのオーバーレイ +home.overlay-pdfs.desc=PDFの上に別のPDFを重ねます。 overlay-pdfs.tags=Overlay -home.split-by-sections.title=Split PDF by Sections -home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections +home.split-by-sections.title=PDFをセクションで分割 +home.split-by-sections.desc=PDFの各ページを縦横に分割します。 split-by-sections.tags=Section Split, Divide, Customize ########################### @@ -572,8 +572,8 @@ removeBlanks.submit=空白ページの削除 #removeAnnotations -removeAnnotations.title=Remove Annotations -removeAnnotations.header=Remove Annotations +removeAnnotations.title=注釈の削除 +removeAnnotations.header=注釈の削除 removeAnnotations.submit=Remove @@ -881,54 +881,53 @@ PDFToXML.credit=本サービスはファイル変換にLibreOfficeを使用し PDFToXML.submit=変換 #PDFToCSV -PDFToCSV.title=PDF??CSV? -PDFToCSV.header=PDF??CSV? -PDFToCSV.prompt=Choose page to extract table -PDFToCSV.submit=???? +PDFToCSV.title=PDFをCSVに変換 +PDFToCSV.header=PDFをCSVに変換 +PDFToCSV.prompt=表を抽出するページを選択 +PDFToCSV.submit=変換 #split-by-size-or-count -split-by-size-or-count.header=Split PDF by Size or Count -split-by-size-or-count.type.label=Select Split Type -split-by-size-or-count.type.size=By Size -split-by-size-or-count.type.pageCount=By Page Count -split-by-size-or-count.type.docCount=By Document Count -split-by-size-or-count.value.label=Enter Value -split-by-size-or-count.value.placeholder=Enter size (e.g., 2MB or 3KB) or count (e.g., 5) -split-by-size-or-count.submit=Submit +split-by-size-or-count.header=サイズまたは数で分割 +split-by-size-or-count.type.label=分割タイプの選択 +split-by-size-or-count.type.size=サイズ +split-by-size-or-count.type.pageCount=ページ数 +split-by-size-or-count.type.docCount=ドキュメント数 +split-by-size-or-count.value.label=値の入力 +split-by-size-or-count.value.placeholder=サイズ (例、2MB または 3KB) または数値 (例、5) を入力 +split-by-size-or-count.submit=分割 #overlay-pdfs -overlay-pdfs.header=Overlay PDF Files -overlay-pdfs.baseFile.label=Select Base PDF File -overlay-pdfs.overlayFiles.label=Select Overlay PDF Files -overlay-pdfs.mode.label=Select Overlay Mode -overlay-pdfs.mode.sequential=Sequential Overlay -overlay-pdfs.mode.interleaved=Interleaved Overlay -overlay-pdfs.mode.fixedRepeat=Fixed Repeat Overlay -overlay-pdfs.counts.label=Overlay Counts (for Fixed Repeat Mode) -overlay-pdfs.counts.placeholder=Enter comma-separated counts (e.g., 2,3,1) -overlay-pdfs.position.label=Select Overlay Position -overlay-pdfs.position.foreground=Foreground -overlay-pdfs.position.background=Background -overlay-pdfs.submit=Submit +overlay-pdfs.header=PDFのオーバーレイ +overlay-pdfs.baseFile.label=ベースのPDFを選択 +overlay-pdfs.overlayFiles.label=重ねるPDFを選択 +overlay-pdfs.mode.label=オーバーレイモードの選択 +overlay-pdfs.mode.sequential=シーケンシャル・オーバーレイ +overlay-pdfs.mode.interleaved=インターリーブ・オーバーレイ +overlay-pdfs.mode.fixedRepeat=固定リピート・オーバーレイ +overlay-pdfs.counts.label=オーバーレイ回数 (固定リピートモード用) +overlay-pdfs.counts.placeholder=カンマ区切りでカウントを入力 (例、2,3,1) +overlay-pdfs.position.label=重ね位置の選択 +overlay-pdfs.position.foreground=前面 +overlay-pdfs.position.background=背面 +overlay-pdfs.submit=重ねる #split-by-sections -split-by-sections.title=Split PDF by Sections -split-by-sections.header=Split PDF into Sections -split-by-sections.horizontal.label=Horizontal Divisions -split-by-sections.vertical.label=Vertical Divisions -split-by-sections.horizontal.placeholder=Enter number of horizontal divisions -split-by-sections.vertical.placeholder=Enter number of vertical divisions -split-by-sections.submit=Split PDF +split-by-sections.title=セクションごとにPDFを分割する +split-by-sections.header=PDFをセクションに分割 +split-by-sections.horizontal.label=水平方向 +split-by-sections.vertical.label=垂直方向 +split-by-sections.horizontal.placeholder=水平方向の分割数を選択 +split-by-sections.vertical.placeholder=垂直方向の分割数を選択 +split-by-sections.submit=分割 #licenses -licenses.nav=Licenses -licenses.title=3rd Party Licenses -licenses.header=3rd Party Licenses -licenses.module=Module -licenses.version=Version -licenses.license=License - +licenses.nav=ライセンス +licenses.title=サードパーティライセンス +licenses.header=サードパーティライセンス +licenses.module=モジュール +licenses.version=バージョン +licenses.license=ライセンス From e43e6d18b99e7c41baf2c9d744998e11ebfb11a7 Mon Sep 17 00:00:00 2001 From: Stirling-PDF-Bot Date: Wed, 17 Jan 2024 23:52:12 +0000 Subject: [PATCH 09/90] Update 3rd Party Licenses --- .../resources/static/3rdPartyLicenses.json | 78 +++++++++++++++++-- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/src/main/resources/static/3rdPartyLicenses.json b/src/main/resources/static/3rdPartyLicenses.json index 88263b1d..699be591 100644 --- a/src/main/resources/static/3rdPartyLicenses.json +++ b/src/main/resources/static/3rdPartyLicenses.json @@ -357,22 +357,29 @@ { "moduleName": "org.apache.pdfbox:fontbox", "moduleUrl": "https://pdfbox.apache.org", - "moduleVersion": "2.0.30", - "moduleLicense": "Apache License, Version 2.0", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "org.apache.pdfbox:pdfbox", "moduleUrl": "https://pdfbox.apache.org", - "moduleVersion": "2.0.30", - "moduleLicense": "Apache License, Version 2.0", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" + }, + { + "moduleName": "org.apache.pdfbox:pdfbox-io", + "moduleUrl": "https://pdfbox.apache.org", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "org.apache.pdfbox:xmpbox", "moduleUrl": "https://pdfbox.apache.org", - "moduleVersion": "2.0.30", - "moduleLicense": "Apache License, Version 2.0", + "moduleVersion": "3.0.1", + "moduleLicense": "Apache-2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" }, { @@ -450,6 +457,12 @@ "moduleLicense": "BSD 2-Clause License", "moduleLicenseUrl": "https://opensource.org/licenses/BSD-2-Clause" }, + { + "moduleName": "org.commonmark:commonmark-ext-gfm-tables", + "moduleVersion": "0.21.0", + "moduleLicense": "BSD 2-Clause License", + "moduleLicenseUrl": "https://opensource.org/licenses/BSD-2-Clause" + }, { "moduleName": "org.eclipse.angus:angus-activation", "moduleUrl": "https://www.eclipse.org", @@ -506,6 +519,52 @@ "moduleLicense": "Public Domain", "moduleLicenseUrl": "http://repository.jboss.org/licenses/cc0-1.0.txt" }, + { + "moduleName": "org.junit.jupiter:junit-jupiter", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.jupiter:junit-jupiter-api", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.jupiter:junit-jupiter-engine", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.jupiter:junit-jupiter-params", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "5.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.platform:junit-platform-commons", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "1.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit.platform:junit-platform-engine", + "moduleUrl": "https://junit.org/junit5/", + "moduleVersion": "1.10.1", + "moduleLicense": "Eclipse Public License v2.0", + "moduleLicenseUrl": "https://www.eclipse.org/legal/epl-v20.html" + }, + { + "moduleName": "org.junit:junit-bom", + "moduleVersion": "5.10.1" + }, { "moduleName": "org.latencyutils:LatencyUtils", "moduleUrl": "http://latencyutils.github.io/LatencyUtils/", @@ -513,6 +572,13 @@ "moduleLicense": "Public Domain, per Creative Commons CC0", "moduleLicenseUrl": "http://creativecommons.org/publicdomain/zero/1.0/" }, + { + "moduleName": "org.opentest4j:opentest4j", + "moduleUrl": "https://github.com/ota4j-team/opentest4j", + "moduleVersion": "1.3.0", + "moduleLicense": "The Apache License, Version 2.0", + "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" + }, { "moduleName": "org.slf4j:jul-to-slf4j", "moduleUrl": "http://www.slf4j.org", From 18d289d3b7d6c1f4ecf57be383f125df3385cace Mon Sep 17 00:00:00 2001 From: Dan Henry Date: Thu, 18 Jan 2024 12:07:02 +1100 Subject: [PATCH 10/90] Move filename input logic to its own function --- .../static/js/multitool/PdfContainer.js | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/main/resources/static/js/multitool/PdfContainer.js b/src/main/resources/static/js/multitool/PdfContainer.js index 4a53c961..4ae7f434 100644 --- a/src/main/resources/static/js/multitool/PdfContainer.js +++ b/src/main/resources/static/js/multitool/PdfContainer.js @@ -74,26 +74,7 @@ class PdfContainer { input.onchange = async(e) => { const files = e.target.files; if (files.length > 0) { - const filenameInput = document.getElementById('filename-input'); - const pagesContainer = document.getElementById('pages-container'); - const downloadBtn = document.getElementById('export-button'); - - filenameInput.disabled = false; - - if (pagesContainer.childElementCount === 0) { - filenameInput.value = ""; - this.filename = null; - downloadBtn.disabled = true; - } else { - this.filename = filenameInput.value; - } - - if (this.filename === null || this.filename === undefined) { - filenameInput.value = files[0].name; - } else { - filenameInput.value = this.filename; - } - + updateFilenameInput() } this.addPdfsFromFiles(files, nextSiblingElement); @@ -102,6 +83,28 @@ class PdfContainer { input.click(); } + updateFilenameInput() { + const filenameInput = document.getElementById('filename-input'); + const pagesContainer = document.getElementById('pages-container'); + const downloadBtn = document.getElementById('export-button'); + + filenameInput.disabled = false; + + if (pagesContainer.childElementCount === 0) { + filenameInput.value = ""; + this.filename = null; + downloadBtn.disabled = true; + } else { + this.filename = filenameInput.value; + } + + if (this.filename === null || this.filename === undefined) { + filenameInput.value = files[0].name; + } else { + filenameInput.value = this.filename; + } + } + async addPdfsFromFiles(files, nextSiblingElement) { this.fileName = files[0].name; for (var i=0; i < files.length; i++) { @@ -275,7 +278,7 @@ class PdfContainer { } updateFilename() { - const filenameInput = document.getElementById('filename-input'); + const filenameInput = document.getElementById('filename-input'); const downloadBtn = document.getElementById('export-button'); if (filenameInput.value === "") { From 1bd17eded6c1c25c4b2caa2fad731b92668aaeb4 Mon Sep 17 00:00:00 2001 From: Dan Henry Date: Thu, 18 Jan 2024 12:08:32 +1100 Subject: [PATCH 11/90] call updateFilenameInput on file drop --- src/main/resources/static/js/multitool/fileInput.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/resources/static/js/multitool/fileInput.js b/src/main/resources/static/js/multitool/fileInput.js index 1a76bd48..fa64d47b 100644 --- a/src/main/resources/static/js/multitool/fileInput.js +++ b/src/main/resources/static/js/multitool/fileInput.js @@ -1,3 +1,5 @@ +import PdfContainer from "./PdfContainer"; + const addFileDragListener = (callback) => { let overlay; let dragCounter = 0; @@ -43,10 +45,14 @@ const addFileDragListener = (callback) => { console.error(err); //maybe }).finally(() => { + // Hide and remove the overlay if (overlay) { overlay.remove(); overlay = null; } + + // Enable/disable filename input + PdfContainer.updateFilenameInput() }); }; From a5165b04cd48d70ee161203a62daf2b933e7f17d Mon Sep 17 00:00:00 2001 From: sbplat <71648843+sbplat@users.noreply.github.com> Date: Thu, 18 Jan 2024 01:08:31 -0500 Subject: [PATCH 12/90] fix(multi-tool): refactor fileInput.js into a class, fix filename variable typos, and update updateFilename logic for dropping files --- .../security/UserAuthenticationFilter.java | 2 +- .../api/SplitPdfBySectionsController.java | 4 +- .../static/js/multitool/PdfContainer.js | 60 +++------ .../static/js/multitool/fileInput.js | 121 ++++++++++-------- src/main/resources/templates/multi-tool.html | 13 +- 5 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/config/security/UserAuthenticationFilter.java b/src/main/java/stirling/software/SPDF/config/security/UserAuthenticationFilter.java index 61b209de..47423eb6 100644 --- a/src/main/java/stirling/software/SPDF/config/security/UserAuthenticationFilter.java +++ b/src/main/java/stirling/software/SPDF/config/security/UserAuthenticationFilter.java @@ -115,4 +115,4 @@ public class UserAuthenticationFilter extends OncePerRequestFilter { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java index de3e5a4b..90418169 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java @@ -121,8 +121,8 @@ public class SplitPdfBySectionsController { subDoc, subPage, AppendMode.APPEND, true, true)) { // Set clipping area and position float translateX = -subPageWidth * i; - - //float translateY = height - subPageHeight * (verticalDivisions - j); + + // float translateY = height - subPageHeight * (verticalDivisions - j); float translateY = -subPageHeight * (verticalDivisions - 1 - j); contentStream.saveGraphicsState(); diff --git a/src/main/resources/static/js/multitool/PdfContainer.js b/src/main/resources/static/js/multitool/PdfContainer.js index 4ae7f434..7ff2e945 100644 --- a/src/main/resources/static/js/multitool/PdfContainer.js +++ b/src/main/resources/static/js/multitool/PdfContainer.js @@ -26,6 +26,7 @@ class PdfContainer { movePageTo: this.movePageTo, addPdfs: this.addPdfs, rotateElement: this.rotateElement, + updateFilename: this.updateFilename }) }) @@ -38,7 +39,7 @@ class PdfContainer { filenameInput.onkeyup = this.updateFilename; filenameInput.onkeydown = this.preventIllegalChars; - filenameInput.disabled = true; + filenameInput.disabled = false; filenameInput.innerText = ""; downloadBtn.disabled = true; } @@ -59,7 +60,7 @@ class PdfContainer { const vector = (endIndex !== -1 && startIndex > endIndex) ? 0-width : width; - + this.pagesContainerWrapper.scroll({ left: this.pagesContainerWrapper.scrollLeft + vector, }) @@ -73,38 +74,14 @@ class PdfContainer { input.setAttribute("accept", "application/pdf"); input.onchange = async(e) => { const files = e.target.files; - if (files.length > 0) { - updateFilenameInput() - } this.addPdfsFromFiles(files, nextSiblingElement); + this.updateFilename(files ? files[0].name : ""); } input.click(); } - updateFilenameInput() { - const filenameInput = document.getElementById('filename-input'); - const pagesContainer = document.getElementById('pages-container'); - const downloadBtn = document.getElementById('export-button'); - - filenameInput.disabled = false; - - if (pagesContainer.childElementCount === 0) { - filenameInput.value = ""; - this.filename = null; - downloadBtn.disabled = true; - } else { - this.filename = filenameInput.value; - } - - if (this.filename === null || this.filename === undefined) { - filenameInput.value = files[0].name; - } else { - filenameInput.value = this.filename; - } - } - async addPdfsFromFiles(files, nextSiblingElement) { this.fileName = files[0].name; for (var i=0; i < files.length; i++) { @@ -200,7 +177,7 @@ class PdfContainer { return pdfDoc; } - + rotateAll(deg) { for (var i=0; i { - let overlay; - let dragCounter = 0; + constructor(cb = null) { + this.dragCounter = 0; + this.setCallback(cb); - const dragenterListener = function() { - dragCounter++; - if (!overlay) { + // Prevent default behavior for drag events + ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { + document.body.addEventListener(eventName, preventDefaults, false); + }); + + function preventDefaults(e) { + e.preventDefault(); + e.stopPropagation(); + } + + this.dragenterListener = this.dragenterListener.bind(this); + this.dragleaveListener = this.dragleaveListener.bind(this); + this.dropListener = this.dropListener.bind(this); + + document.body.addEventListener('dragenter', this.dragenterListener); + document.body.addEventListener('dragleave', this.dragleaveListener); + // Add drop event listener + document.body.addEventListener('drop', this.dropListener); + } + + setActions({ updateFilename }) { + this.updateFilename = updateFilename; + } + + setCallback(cb) { + if (cb) { + this.callback = cb; + } else { + this.callback = (files) => console.warn("FileDragManager not set"); + } + } + + dragenterListener() { + this.dragCounter++; + if (!this.overlay) { // Create and show the overlay - overlay = document.createElement('div'); - overlay.style.position = 'fixed'; - overlay.style.top = 0; - overlay.style.left = 0; - overlay.style.width = '100%'; - overlay.style.height = '100%'; - overlay.style.background = 'rgba(0, 0, 0, 0.5)'; - overlay.style.color = '#fff'; - overlay.style.zIndex = '1000'; - overlay.style.display = 'flex'; - overlay.style.alignItems = 'center'; - overlay.style.justifyContent = 'center'; - overlay.style.pointerEvents = 'none'; - overlay.innerHTML = '

Drop files anywhere to upload

'; - document.getElementById('content-wrap').appendChild(overlay); + this.overlay = document.createElement('div'); + this.overlay.style.position = 'fixed'; + this.overlay.style.top = 0; + this.overlay.style.left = 0; + this.overlay.style.width = '100%'; + this.overlay.style.height = '100%'; + this.overlay.style.background = 'rgba(0, 0, 0, 0.5)'; + this.overlay.style.color = '#fff'; + this.overlay.style.zIndex = '1000'; + this.overlay.style.display = 'flex'; + this.overlay.style.alignItems = 'center'; + this.overlay.style.justifyContent = 'center'; + this.overlay.style.pointerEvents = 'none'; + this.overlay.innerHTML = '

Drop files anywhere to upload

'; + document.getElementById('content-wrap').appendChild(this.overlay); } }; - const dragleaveListener = function() { - dragCounter--; - if (dragCounter === 0) { + dragleaveListener() { + this.dragCounter--; + if (this.dragCounter === 0) { // Hide and remove the overlay - if (overlay) { - overlay.remove(); - overlay = null; + if (this.overlay) { + this.overlay.remove(); + this.overlay = null; } } }; - const dropListener = function(e) { + dropListener(e) { const dt = e.dataTransfer; const files = dt.files; - callback(files).catch((err) => { + this.callback(files).catch((err) => { console.error(err); //maybe }).finally(() => { // Hide and remove the overlay - if (overlay) { - overlay.remove(); - overlay = null; + if (this.overlay) { + this.overlay.remove(); + this.overlay = null; } - // Enable/disable filename input - PdfContainer.updateFilenameInput() + this.updateFilename(files ? files[0].name : ""); }); }; - - // Prevent default behavior for drag events - ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { - document.body.addEventListener(eventName, preventDefaults, false); - }); - - function preventDefaults(e) { - e.preventDefault(); - e.stopPropagation(); - } - - document.body.addEventListener('dragenter', dragenterListener); - document.body.addEventListener('dragleave', dragleaveListener); - // Add drop event listener - document.body.addEventListener('drop', dropListener); } -export default addFileDragListener; \ No newline at end of file +export default FileDragManager; diff --git a/src/main/resources/templates/multi-tool.html b/src/main/resources/templates/multi-tool.html index d602cbe9..d49b7f83 100644 --- a/src/main/resources/templates/multi-tool.html +++ b/src/main/resources/templates/multi-tool.html @@ -49,7 +49,7 @@ - + diff --git a/src/main/resources/templates/convert/markdown-to-pdf.html b/src/main/resources/templates/convert/markdown-to-pdf.html index c8193112..4606d2b5 100644 --- a/src/main/resources/templates/convert/markdown-to-pdf.html +++ b/src/main/resources/templates/convert/markdown-to-pdf.html @@ -13,7 +13,7 @@

-
+

diff --git a/src/main/resources/templates/fragments/navbar.html b/src/main/resources/templates/fragments/navbar.html index b090b08c..aec6b826 100644 --- a/src/main/resources/templates/fragments/navbar.html +++ b/src/main/resources/templates/fragments/navbar.html @@ -133,6 +133,7 @@
+
diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index 52f945eb..d42ccb4a 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -101,8 +101,10 @@
+
+ diff --git a/src/main/resources/templates/misc/show-javascript.html b/src/main/resources/templates/misc/show-javascript.html index 36f1bb80..0614a2c2 100644 --- a/src/main/resources/templates/misc/show-javascript.html +++ b/src/main/resources/templates/misc/show-javascript.html @@ -18,7 +18,7 @@
+ th:replace="~{fragments/common :: fileSelector(name='fileInput', multiple=false, remoteCall='false', accept='application/pdf')}">
diff --git a/src/main/resources/templates/misc/stamp.html b/src/main/resources/templates/misc/stamp.html new file mode 100644 index 00000000..a05e9717 --- /dev/null +++ b/src/main/resources/templates/misc/stamp.html @@ -0,0 +1,216 @@ + + + + + + + + +
+
+
+

+
+
+
+

+ +
+
+
+ + +
+ + + +
+ +
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
+
+ + + + + +
+ + +
+ +
+ + +
+ + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + +
+
+
+ +
+
+
+ + diff --git a/src/main/resources/templates/pdf-to-single-page.html b/src/main/resources/templates/pdf-to-single-page.html index c8dedca5..6c26ace5 100644 --- a/src/main/resources/templates/pdf-to-single-page.html +++ b/src/main/resources/templates/pdf-to-single-page.html @@ -14,7 +14,7 @@

-
+
diff --git a/src/main/resources/templates/security/get-info-on-pdf.html b/src/main/resources/templates/security/get-info-on-pdf.html index 41ff4be7..84bf8692 100644 --- a/src/main/resources/templates/security/get-info-on-pdf.html +++ b/src/main/resources/templates/security/get-info-on-pdf.html @@ -16,7 +16,7 @@
+ th:replace="~{fragments/common :: fileSelector(name='fileInput', multiple=false, remoteCall='false', accept='application/pdf')}">
From ba4ad1aff91500578dd6f93c4b617ed473c1f468 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 28 Jan 2024 17:37:02 +0000 Subject: [PATCH 22/90] langs --- src/main/resources/messages_ar_AR.properties | 39 ++++++++++++++++++- src/main/resources/messages_bg_BG.properties | 39 ++++++++++++++++++- src/main/resources/messages_ca_CA.properties | 39 ++++++++++++++++++- src/main/resources/messages_de_DE.properties | 39 ++++++++++++++++++- src/main/resources/messages_el_GR.properties | 39 ++++++++++++++++++- src/main/resources/messages_en_US.properties | 39 ++++++++++++++++++- src/main/resources/messages_es_ES.properties | 39 ++++++++++++++++++- src/main/resources/messages_eu_ES.properties | 39 ++++++++++++++++++- src/main/resources/messages_fr_FR.properties | 39 ++++++++++++++++++- src/main/resources/messages_hi_IN.properties | 39 ++++++++++++++++++- src/main/resources/messages_hu_HU.properties | 39 ++++++++++++++++++- src/main/resources/messages_id_ID.properties | 39 ++++++++++++++++++- src/main/resources/messages_it_IT.properties | 39 ++++++++++++++++++- src/main/resources/messages_ja_JP.properties | 39 ++++++++++++++++++- src/main/resources/messages_ko_KR.properties | 39 ++++++++++++++++++- src/main/resources/messages_nl_NL.properties | 39 ++++++++++++++++++- src/main/resources/messages_pl_PL.properties | 39 ++++++++++++++++++- src/main/resources/messages_pt_BR.properties | 39 ++++++++++++++++++- src/main/resources/messages_ro_RO.properties | 39 ++++++++++++++++++- src/main/resources/messages_ru_RU.properties | 39 ++++++++++++++++++- .../resources/messages_sr-Latn-RS.properties | 39 ++++++++++++++++++- src/main/resources/messages_sv_SE.properties | 39 ++++++++++++++++++- src/main/resources/messages_tr_TR.properties | 39 ++++++++++++++++++- src/main/resources/messages_zh_CN.properties | 39 ++++++++++++++++++- src/main/resources/messages_zh_TW.properties | 39 ++++++++++++++++++- 25 files changed, 950 insertions(+), 25 deletions(-) diff --git a/src/main/resources/messages_ar_AR.properties b/src/main/resources/messages_ar_AR.properties index cac25052..f37a67a5 100644 --- a/src/main/resources/messages_ar_AR.properties +++ b/src/main/resources/messages_ar_AR.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML To PDF HTMLToPDF.help=Accepts HTML files and ZIPs containing html/css/images etc required HTMLToPDF.submit=Convert HTMLToPDF.credit=Uses WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitize PDF sanitizePDF.header=Sanitize a PDF file diff --git a/src/main/resources/messages_bg_BG.properties b/src/main/resources/messages_bg_BG.properties index e31749ca..13dce03c 100644 --- a/src/main/resources/messages_bg_BG.properties +++ b/src/main/resources/messages_bg_BG.properties @@ -44,7 +44,8 @@ blue=Синьо custom=Персонализиране... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Идентификационните данни са променени! notAuthenticatedMessage=Потребителят не е автентикиран. userNotFoundMessage=Потребителят не е намерен @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML към PDF HTMLToPDF.help=Приема HTML файлове и ZIP файлове, съдържащи html/css/изображения и т.н HTMLToPDF.submit=Преобразуване HTMLToPDF.credit=Използва WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Дезинфектирай PDF sanitizePDF.header=Дезинфектира PDF файл diff --git a/src/main/resources/messages_ca_CA.properties b/src/main/resources/messages_ca_CA.properties index 406eee89..8e6dd4fa 100644 --- a/src/main/resources/messages_ca_CA.properties +++ b/src/main/resources/messages_ca_CA.properties @@ -44,7 +44,8 @@ blue=Blau custom=Personalitzat... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML To PDF HTMLToPDF.help=Accepts HTML files and ZIPs containing html/css/images etc required HTMLToPDF.submit=Convert HTMLToPDF.credit=Uses WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitize PDF sanitizePDF.header=Sanitize a PDF file diff --git a/src/main/resources/messages_de_DE.properties b/src/main/resources/messages_de_DE.properties index 082918c3..cac32d58 100644 --- a/src/main/resources/messages_de_DE.properties +++ b/src/main/resources/messages_de_DE.properties @@ -44,7 +44,8 @@ blue=Blau custom=benutzerdefiniert... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Anmeldedaten geändert! notAuthenticatedMessage=Benutzer nicht authentifiziert. userNotFoundMessage=Benutzer nicht gefunden. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML zu PDF HTMLToPDF.help=Akzeptiert HTML-Dateien und ZIPs mit html/css/images etc. HTMLToPDF.submit=Konvertieren HTMLToPDF.credit=Verwendet WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=PDF Bereinigen sanitizePDF.header=PDF Bereinigen diff --git a/src/main/resources/messages_el_GR.properties b/src/main/resources/messages_el_GR.properties index 83bf96b4..2e45c141 100644 --- a/src/main/resources/messages_el_GR.properties +++ b/src/main/resources/messages_el_GR.properties @@ -44,7 +44,8 @@ blue=\u039C\u03C0\u03BB\u03AD custom=\u03A0\u03C1\u03BF\u03C3\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=\u03A4\u03B1 \u03B4\u03B9\u03B1\u03C0\u03B9\u03C3\u03C4\u03B5\u03C5\u03C4\u03AE\u03C1\u03B9\u03B1 \u03AD\u03C7\u03BF\u03C5\u03BD \u03B1\u03BB\u03BB\u03AC\u03BE\u03B5\u03B9! notAuthenticatedMessage=\u039F \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7\u03C2 \u03B4\u03B5\u03BD \u03AD\u03C7\u03B5\u03B9 \u03B1\u03C5\u03B8\u03B5\u03BD\u03C4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03B8\u03B5\u03AF. userNotFoundMessage=\u039F \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7\u03C2 \u03B4\u03B5\u03BD \u03B2\u03C1\u03AD\u03B8\u03B7\u03BA\u03B5. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML \u03C3\u03B5 PDF HTMLToPDF.help=\u0394\u03AD\u03C7\u03B5\u03C4\u03B1\u03B9 \u03B1\u03C1\u03C7\u03B5\u03AF\u03B1 \u03C4\u03CD\u03C0\u03BF\u03C5 HTML \u03BA\u03B1\u03B9 \u03C4\u03CD\u03C0\u03BF\u03C5 ZIP \u03C0\u03BF\u03C5 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03BF\u03C5\u03BD html/css/\u03B5\u03B9\u03BA\u03CC\u03BD\u03B5\u03C2 \u03BA.\u03BB\u03C0. \u03C0\u03BF\u03C5 \u03B1\u03C0\u03B1\u03B9\u03C4\u03BF\u03CD\u03BD\u03C4\u03B1\u03B9 HTMLToPDF.submit=\u039C\u03B5\u03C4\u03B1\u03C4\u03C1\u03BF\u03C0\u03AE HTMLToPDF.credit=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=\u0391\u03C0\u03BF\u03BB\u03CD\u03BC\u03B1\u03BD\u03C3\u03B7 PDF sanitizePDF.header=\u0391\u03C0\u03BF\u03BB\u03CD\u03BC\u03B1\u03BD\u03C3\u03B7 \u03B5\u03BD\u03CC\u03C2 PDF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5 diff --git a/src/main/resources/messages_en_US.properties b/src/main/resources/messages_en_US.properties index d6f7ef71..58bdafda 100644 --- a/src/main/resources/messages_en_US.properties +++ b/src/main/resources/messages_en_US.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML To PDF HTMLToPDF.help=Accepts HTML files and ZIPs containing html/css/images etc required HTMLToPDF.submit=Convert HTMLToPDF.credit=Uses WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitize PDF sanitizePDF.header=Sanitize a PDF file diff --git a/src/main/resources/messages_es_ES.properties b/src/main/resources/messages_es_ES.properties index 887b14de..538cc776 100644 --- a/src/main/resources/messages_es_ES.properties +++ b/src/main/resources/messages_es_ES.properties @@ -44,7 +44,8 @@ blue=Azul custom=Personalizado... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Se cambiaron las credenciales! notAuthenticatedMessage=Usuario no autentificado. userNotFoundMessage=Usuario no encontrado. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Dividir PDF por Secciones home.split-by-sections.desc=Dividir cada página de un PDF en secciones verticales y horizontales más pequeñas split-by-sections.tags=Dividir sección, Dividir, Personalizar +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML a PDF HTMLToPDF.help=Acepta archivos HTML y ZIPs conteniendo los html/css/imágenes, etc, requeridas HTMLToPDF.submit=Convertir HTMLToPDF.credit=Utiliza WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Desinfectar archivo PDF sanitizePDF.header=Desinfectar un archivo PDF diff --git a/src/main/resources/messages_eu_ES.properties b/src/main/resources/messages_eu_ES.properties index ef9b628a..4a3e8552 100644 --- a/src/main/resources/messages_eu_ES.properties +++ b/src/main/resources/messages_eu_ES.properties @@ -44,7 +44,8 @@ blue=Urdina custom=Pertsonalizatu... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML bat PDF-ra HTMLToPDF.help=Html/css/images etab dituen HTML eta Zip fitxategiak onartzen ditu HTMLToPDF.submit=Bihurtu HTMLToPDF.credit=WeasyPrint darabil +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=PDF-a desinfektatu sanitizePDF.header=PDF fitxategi bat desinfektatu diff --git a/src/main/resources/messages_fr_FR.properties b/src/main/resources/messages_fr_FR.properties index 80da3038..d6462b66 100644 --- a/src/main/resources/messages_fr_FR.properties +++ b/src/main/resources/messages_fr_FR.properties @@ -44,7 +44,8 @@ blue=Bleu custom=Personnalisé\u2026 WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Les identifiants ont été mis à jour\u00a0! notAuthenticatedMessage=Utilisateur non authentifié. userNotFoundMessage=Utilisateur non trouvé. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML en PDF HTMLToPDF.help=Accepte les fichiers HTML et les ZIP contenant du HTML, du CSS, des images, etc. (requis). HTMLToPDF.submit=Convertir HTMLToPDF.credit=Utilise WeasyPrint. +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Assainir sanitizePDF.header=Assainir diff --git a/src/main/resources/messages_hi_IN.properties b/src/main/resources/messages_hi_IN.properties index a44f3c5b..5b33891d 100644 --- a/src/main/resources/messages_hi_IN.properties +++ b/src/main/resources/messages_hi_IN.properties @@ -44,7 +44,8 @@ blue=नीला custom=कस्टम... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=क्रेडेंशियल्स बदल दी गईं! notAuthenticatedMessage=उपयोगकर्ता प्रमाणित नहीं है। userNotFoundMessage=उपयोगकर्ता नहीं मिला। @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=खंडों से पीडीएफ़ वि home.split-by-sections.desc=पीडीएफ़ के प्रत्येक पृष्ठ को छोटे से छोटे क्षैतिज और ऊर्ध्वाधर खंडों में विभाजित करें split-by-sections.tags=खंड विभाजन, विभाजित करें, अनुकूलित +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML से पीडीएफ़ HTMLToPDF.help=HTML फ़ाइलों और html/css/images आदि को आत्मसात करने वाले ZIPs को स्वीकार करता है HTMLToPDF.submit=रूपांतरित करें HTMLToPDF.credit=WeasyPrint का प्रयोग होता है +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=पीडीएफ़ को सफाई करें sanitizePDF.header=एक पीडीएफ़ फ़ाइल को सफाई करें diff --git a/src/main/resources/messages_hu_HU.properties b/src/main/resources/messages_hu_HU.properties index 7a43b8ce..c1364ce1 100644 --- a/src/main/resources/messages_hu_HU.properties +++ b/src/main/resources/messages_hu_HU.properties @@ -44,7 +44,8 @@ blue=Kék custom=Egyedi... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=A hitelek megváltoztak! notAuthenticatedMessage=Felhasználó nincs hitelesítve. userNotFoundMessage=A felhasználó nem található. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=PDF Szakaszokra osztása home.split-by-sections.desc=Minden oldal felosztása kisebb vízszintes és függőleges szakaszokra split-by-sections.tags=Szakasz elosztás, felosztás, testreszabás +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML >> PDF HTMLToPDF.help=Elfogad HTML fájlokat és ZIP-fájlokat, amelyek tartalmaznak html/css/képeket stb. HTMLToPDF.submit=Átalakítás HTMLToPDF.credit=WeasyPrint alkalmazása +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=PDF tisztítása sanitizePDF.header=PDF fájl megtisztítása diff --git a/src/main/resources/messages_id_ID.properties b/src/main/resources/messages_id_ID.properties index b3ed56a9..926dcd1b 100644 --- a/src/main/resources/messages_id_ID.properties +++ b/src/main/resources/messages_id_ID.properties @@ -44,7 +44,8 @@ blue=Biru custom=Kustom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Kredensial berubah!! notAuthenticatedMessage=Pengguna tidak ter-autentikasi. userNotFoundMessage=Pengguna tidak ditemukan. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Membagi PDF berdasarkan Bagian home.split-by-sections.desc=Membagi setiap halaman PDF menjadi beberapa bagian horizontal dan vertikal yang lebih kecil split-by-sections.tags=Membagi Bagian, Membagi, Menyesuaikan +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML Ke PDF HTMLToPDF.help=Menerima berkas HTML dan ZIP yang berisi html / css / gambar, dll yang diperlukan HTMLToPDF.submit=Konversi HTMLToPDF.credit=Menggunakan WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Bersihkan PDF sanitizePDF.header=Membersihkan berkas PDF diff --git a/src/main/resources/messages_it_IT.properties b/src/main/resources/messages_it_IT.properties index 7ef311ba..b9d011bf 100644 --- a/src/main/resources/messages_it_IT.properties +++ b/src/main/resources/messages_it_IT.properties @@ -44,7 +44,8 @@ blue=Blu custom=Personalizzato WorkInProgess=Lavori in corso, potrebbe non funzionare o essere difettoso, segnalare eventuali problemi! poweredBy=Alimentato da - +yes=Yes +no=No changedCredsMessage=Credenziali cambiate! notAuthenticatedMessage=Utente non autenticato. userNotFoundMessage=Utente non trovato. @@ -68,6 +69,7 @@ pipelineOptions.header=Configurazione Pipeline pipelineOptions.pipelineNameLabel=Nome della Pipeline pipelineOptions.saveSettings=Salva Impostazioni pipelineOptions.pipelineNamePrompt=Inserisci qui il nome della pipeline +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Aggiungi operazione pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Dividi PDF per sezioni home.split-by-sections.desc=Dividi ciascuna pagina di un PDF in sezioni orizzontali e verticali più piccole split-by-sections.tags=Dividi sezione, dividi, personalizza +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML a PDF HTMLToPDF.help=Accetta file HTML e ZIP contenenti html/css/immagini ecc. richiesti HTMLToPDF.submit=Converti HTMLToPDF.credit=Utilizza WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Pulire PDF sanitizePDF.header=Pulisci un file PDF diff --git a/src/main/resources/messages_ja_JP.properties b/src/main/resources/messages_ja_JP.properties index 7ba8b206..f369807b 100644 --- a/src/main/resources/messages_ja_JP.properties +++ b/src/main/resources/messages_ja_JP.properties @@ -44,7 +44,8 @@ blue=青 custom=カスタム... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=資格情報が変更されました! notAuthenticatedMessage=ユーザーが認証されていません。 userNotFoundMessage=ユーザーが見つかりません。 @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTMLをPDFに変換 HTMLToPDF.help=HTMLファイルと必要なhtml/css/画像などを含むZIPを受け入れます HTMLToPDF.submit=変換 HTMLToPDF.credit=WeasyPrintを使用 +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=PDFをサニタイズ sanitizePDF.header=PDFファイルをサニタイズ diff --git a/src/main/resources/messages_ko_KR.properties b/src/main/resources/messages_ko_KR.properties index 0213dc79..bebdb217 100644 --- a/src/main/resources/messages_ko_KR.properties +++ b/src/main/resources/messages_ko_KR.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=계정 정보 변경 성공! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=사용자를 찾을 수 없습니다. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML 파일을 PDF 문서로 변환 HTMLToPDF.help=HTML 파일, 또는 html/css/이미지 등을 포함한 ZIP 파일을 받습니다. HTMLToPDF.submit=변환 HTMLToPDF.credit=이 기능은 WeasyPrint를 사용합니다. +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=PDF 정제 sanitizePDF.header=PDF 문서 정제 diff --git a/src/main/resources/messages_nl_NL.properties b/src/main/resources/messages_nl_NL.properties index bcfa528c..bac726df 100644 --- a/src/main/resources/messages_nl_NL.properties +++ b/src/main/resources/messages_nl_NL.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML naar PDF HTMLToPDF.help=Accepteert HTML-bestanden en ZIP''s die html/css/afbeeldingen etc. bevatten HTMLToPDF.submit=Converteren HTMLToPDF.credit=Gebruikt WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=PDF opschonen sanitizePDF.header=Een PDF-bestand opschonen diff --git a/src/main/resources/messages_pl_PL.properties b/src/main/resources/messages_pl_PL.properties index 5d08a346..48411999 100644 --- a/src/main/resources/messages_pl_PL.properties +++ b/src/main/resources/messages_pl_PL.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML To PDF HTMLToPDF.help=Accepts HTML files and ZIPs containing html/css/images etc required HTMLToPDF.submit=Convert HTMLToPDF.credit=Uses WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitize PDF sanitizePDF.header=Sanitize a PDF file diff --git a/src/main/resources/messages_pt_BR.properties b/src/main/resources/messages_pt_BR.properties index 5002f064..0976d83f 100644 --- a/src/main/resources/messages_pt_BR.properties +++ b/src/main/resources/messages_pt_BR.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML para PDF HTMLToPDF.help=Aceita arquivos HTML e ZIPs contendo html/css/imagens etc necessários HTMLToPDF.submit=Converter HTMLToPDF.credit=Usa o WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitizar PDF sanitizePDF.header=Sanitizar um arquivo PDF diff --git a/src/main/resources/messages_ro_RO.properties b/src/main/resources/messages_ro_RO.properties index dbbd73d2..d6f3b97a 100644 --- a/src/main/resources/messages_ro_RO.properties +++ b/src/main/resources/messages_ro_RO.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML To PDF HTMLToPDF.help=Accepts HTML files and ZIPs containing html/css/images etc required HTMLToPDF.submit=Convert HTMLToPDF.credit=Uses WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitize PDF sanitizePDF.header=Sanitize a PDF file diff --git a/src/main/resources/messages_ru_RU.properties b/src/main/resources/messages_ru_RU.properties index 1b6fa7f0..289b0fa6 100644 --- a/src/main/resources/messages_ru_RU.properties +++ b/src/main/resources/messages_ru_RU.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML в PDF HTMLToPDF.help=Принимает файлы HTML и ZIP-файлы, содержащие html/css/изображения и т. д. HTMLToPDF.submit=Конвертировать HTMLToPDF.credit=Использует WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Дезинфицировать PDF sanitizePDF.header=Дезинфицировать PDF файл diff --git a/src/main/resources/messages_sr-Latn-RS.properties b/src/main/resources/messages_sr-Latn-RS.properties index 620e7df8..9ff6d44a 100644 --- a/src/main/resources/messages_sr-Latn-RS.properties +++ b/src/main/resources/messages_sr-Latn-RS.properties @@ -44,7 +44,8 @@ blue=Plavo custom=Prilagođeno... WorkInProgess=Radovi u toku, možda neće raditi ili će biti grešaka, molimo prijavite sve probleme ! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Podaci za prijavu uspešno promenjeni! notAuthenticatedMessage=Korisnik nije autentifikovan. userNotFoundMessage=Korisnik nije pronađen. @@ -68,6 +69,7 @@ pipelineOptions.header=Konfiguracija Pipeline-a pipelineOptions.pipelineNameLabel=Ime Pipeline-a pipelineOptions.saveSettings=Sačuvaj podešavanja pipelineOptions.pipelineNamePrompt=Unesite ime pipeline-a ovde +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Dodaj operaciju pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Preuzmi @@ -384,6 +386,11 @@ home.split-by-sections.title=Deljenje PDF-a po Odeljcima home.split-by-sections.desc=Deljenje svake stranice PDF-a na manje horizontalne i vertikalne odeljke split-by-sections.tags=Deljenje odeljaka,Deljenje,Podešavanje +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML u PDF HTMLToPDF.help=Prihvata HTML fajlove i ZIP-ove koji sadrže html/css/slike itd. potrebno HTMLToPDF.submit=Konvertuj HTMLToPDF.credit=Koristi WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitizacija PDF-a sanitizePDF.header=Sanitizacija PDF fajla diff --git a/src/main/resources/messages_sv_SE.properties b/src/main/resources/messages_sv_SE.properties index 85e2559c..85a934b2 100644 --- a/src/main/resources/messages_sv_SE.properties +++ b/src/main/resources/messages_sv_SE.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Credentials changed! notAuthenticatedMessage=User not authenticated. userNotFoundMessage=User not found. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML To PDF HTMLToPDF.help=Accepts HTML files and ZIPs containing html/css/images etc required HTMLToPDF.submit=Convert HTMLToPDF.credit=Uses WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=Sanitize PDF sanitizePDF.header=Sanitize a PDF file diff --git a/src/main/resources/messages_tr_TR.properties b/src/main/resources/messages_tr_TR.properties index f3071b00..caae0867 100644 --- a/src/main/resources/messages_tr_TR.properties +++ b/src/main/resources/messages_tr_TR.properties @@ -44,7 +44,8 @@ blue=Mavi custom=Özel WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=Bilgiler değiştirildi! notAuthenticatedMessage=Kullanıcı doğrulanmadı. userNotFoundMessage=Kullanıcı bulunamadı. @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=Split PDF by Sections home.split-by-sections.desc=Divide each page of a PDF into smaller horizontal and vertical sections split-by-sections.tags=Section Split, Divide, Customize +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML'den PDF'e HTMLToPDF.help=HTML dosyalarını ve html/css/görsel vb. içeren ZIP'leri kabul eder HTMLToPDF.submit=Dönüştür HTMLToPDF.credit=WeasyPrint Kullanıyor +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=PDF'i Temizle sanitizePDF.header=PDF dosyasını temizle diff --git a/src/main/resources/messages_zh_CN.properties b/src/main/resources/messages_zh_CN.properties index 7498b0c9..46934cba 100644 --- a/src/main/resources/messages_zh_CN.properties +++ b/src/main/resources/messages_zh_CN.properties @@ -44,7 +44,8 @@ blue=Blue custom=Custom... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=凭证已更改! notAuthenticatedMessage=用户未经过身份验证。 userNotFoundMessage=未找到用户。 @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=拆分PDF成小块 home.split-by-sections.desc=将PDF的每一页分割成更小的水平和垂直的部分 split-by-sections.tags=章节拆分、分割、自定义 +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML转PDF HTMLToPDF.help=接受HTML文件和包含所需的html/css/images等的ZIP文件 HTMLToPDF.submit=转换 HTMLToPDF.credit=使用WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=清理PDF sanitizePDF.header=清理PDF文件 diff --git a/src/main/resources/messages_zh_TW.properties b/src/main/resources/messages_zh_TW.properties index b6a8811c..e2f0e4d9 100644 --- a/src/main/resources/messages_zh_TW.properties +++ b/src/main/resources/messages_zh_TW.properties @@ -44,7 +44,8 @@ blue=藍色 custom=自訂... WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! poweredBy=Powered by - +yes=Yes +no=No changedCredsMessage=憑證已變更! notAuthenticatedMessage=使用者未認證。 userNotFoundMessage=找不到使用者。 @@ -68,6 +69,7 @@ pipelineOptions.header=Pipeline Configuration pipelineOptions.pipelineNameLabel=Pipeline Name pipelineOptions.saveSettings=Save Operation Settings pipelineOptions.pipelineNamePrompt=Enter pipeline name here +pipelineOptions.selectOperation=Select Operation pipelineOptions.addOperationButton=Add operation pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -384,6 +386,11 @@ home.split-by-sections.title=依區段分割 PDF home.split-by-sections.desc=將 PDF 的每一頁分割為較小的水平和垂直區段 split-by-sections.tags=區段分割, 劃分, 自訂 +home.AddStampRequest.title=Add Stamp to PDF +home.AddStampRequest.desc=Add text or add image stamps at set locations +AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize + + ########################### # # # WEB PAGES # @@ -459,8 +466,38 @@ HTMLToPDF.header=HTML 轉 PDF HTMLToPDF.help=接受 HTML 文件和包含所需 html/css/images 等的 ZIP HTMLToPDF.submit=轉換 HTMLToPDF.credit=使用 WeasyPrint +HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) +HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) +HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) +HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) +HTMLToPDF.printBackground=Render the background of websites. +HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) +HTMLToPDF.cssMediaType=Change the CSS media type of the page. +HTMLToPDF.none=None +HTMLToPDF.print=Print +HTMLToPDF.screen=Screen +#AddStampRequest +AddStampRequest.header=Stamp PDF +AddStampRequest.title=Stamp PDF +AddStampRequest.stampType=Stamp Type +AddStampRequest.stampText=Stamp Text +AddStampRequest.stampImage=Stamp Image +AddStampRequest.alphabet=Alphabet +AddStampRequest.fontSize=Font/Image Size +AddStampRequest.rotation=Rotation +AddStampRequest.opacity=Opacity +AddStampRequest.position=Position +AddStampRequest.overrideX=Override X Coordinate +AddStampRequest.overrideY=Override Y Coordinate +AddStampRequest.customMargin=Custom Margin +AddStampRequest.customColor=Custom Text Color +AddStampRequest.submit=Submit + #sanitizePDF sanitizePDF.title=清理 PDF sanitizePDF.header=清理 PDF 檔案 From 89e461e4f63f19177c1c68f1b74e069cd0e01d31 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 28 Jan 2024 17:39:07 +0000 Subject: [PATCH 23/90] formats --- .../api/misc/FakeScanControllerWIP.java | 3 +- .../controller/api/misc/StampController.java | 28 +++++++++++++++---- .../api/pipeline/ApiDocService.java | 2 +- .../controller/web/OtherWebController.java | 3 +- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java index 99595049..cf719f56 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java @@ -29,7 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -50,7 +49,7 @@ public class FakeScanControllerWIP { // TODO @Hidden - //@PostMapping(consumes = "multipart/form-data", value = "/fakeScan") + // @PostMapping(consumes = "multipart/form-data", value = "/fakeScan") @Operation( summary = "Repair a PDF file", description = diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 718c0ddd..0dd4200c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -201,7 +201,15 @@ public class StampController { x = overrideX; y = overrideY; } else { - x = calculatePositionX(pageSize, position, fontSize, font, fontSize, watermarkText, marginFactor); + x = + calculatePositionX( + pageSize, + position, + fontSize, + font, + fontSize, + watermarkText, + marginFactor); y = calculatePositionY(pageSize, position, fontSize, marginFactor); } @@ -247,7 +255,9 @@ public class StampController { x = overrideX; y = overrideY; } else { - x = calculatePositionX(pageSize, position, desiredPhysicalWidth, null, 0, null, marginFactor); + x = + calculatePositionX( + pageSize, position, desiredPhysicalWidth, null, 0, null, marginFactor); y = calculatePositionY(pageSize, position, fontSize, marginFactor); } @@ -259,8 +269,16 @@ public class StampController { } private float calculatePositionX( - PDRectangle pageSize, int position, float contentWidth, PDFont font, float fontSize, String text, float marginFactor) throws IOException { - float actualWidth = (text != null) ? calculateTextWidth(text, font, fontSize) : contentWidth; + PDRectangle pageSize, + int position, + float contentWidth, + PDFont font, + float fontSize, + String text, + float marginFactor) + throws IOException { + float actualWidth = + (text != null) ? calculateTextWidth(text, font, fontSize) : contentWidth; switch (position % 3) { case 1: // Left return pageSize.getLowerLeftX() + marginFactor * pageSize.getWidth(); @@ -277,8 +295,6 @@ public class StampController { return font.getStringWidth(text) / 1000 * fontSize; } - - private float calculatePositionY( PDRectangle pageSize, int position, float height, float marginFactor) { switch ((position - 1) / 3) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java index 25537ee2..27240b6f 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java @@ -66,7 +66,7 @@ public class ApiDocService { "BOOK", Arrays.asList( "epub", "mobi", "azw3", "fb2", "txt", - "docx")); // As noted before, "Boolean" isn't a file type but a value + "docx")); // type. } diff --git a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java index 69609536..a7c10908 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java @@ -38,14 +38,13 @@ public class OtherWebController { model.addAttribute("currentPage", "show-javascript"); return "misc/show-javascript"; } - + @GetMapping("/stamp") @Hidden public String stampForm(Model model) { model.addAttribute("currentPage", "stamp"); return "misc/stamp"; } - @GetMapping("/add-page-numbers") @Hidden From 80604517137406eb7cae316f933c0c46d5d61a7f Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 28 Jan 2024 18:16:59 +0000 Subject: [PATCH 24/90] Update AutoSplitPdfController.java --- .../controller/api/misc/AutoSplitPdfController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java index b793fc3e..cf9b6220 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java @@ -43,6 +43,7 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class AutoSplitPdfController { private static final String QR_CONTENT = "https://github.com/Stirling-Tools/Stirling-PDF"; + private static final String QR_CONTENT_OLD = "https://github.com/Frooodle/Stirling-PDF"; @PostMapping(value = "/auto-split-pdf", consumes = "multipart/form-data") @Operation( @@ -63,12 +64,14 @@ public class AutoSplitPdfController { for (int page = 0; page < document.getNumberOfPages(); ++page) { BufferedImage bim = pdfRenderer.renderImageWithDPI(page, 150); String result = decodeQRCode(bim); - - if (QR_CONTENT.equals(result) && page != 0) { + System.out.println("result = " + result); + if ((QR_CONTENT.equals(result) || QR_CONTENT_OLD.equals(result)) && page != 0) { + System.out.println("page " + (page + 1) + " is QR"); splitDocuments.add(new PDDocument()); } - if (!splitDocuments.isEmpty() && !QR_CONTENT.equals(result)) { + if (!splitDocuments.isEmpty() && !QR_CONTENT.equals(result) && !QR_CONTENT_OLD.equals(result)) { + System.out.println("page " + (page + 1) + " is NOT QR"); splitDocuments.get(splitDocuments.size() - 1).addPage(document.getPage(page)); } else if (page == 0) { PDDocument firstDocument = new PDDocument(); @@ -77,7 +80,7 @@ public class AutoSplitPdfController { } // If duplexMode is true and current page is a divider, then skip next page - if (duplexMode && QR_CONTENT.equals(result)) { + if (duplexMode && (QR_CONTENT.equals(result) || QR_CONTENT_OLD.equals(result))) { page++; } } From 6acb593411da56a1c05465f0f1cc0e9ec8f19571 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 28 Jan 2024 18:17:32 +0000 Subject: [PATCH 25/90] Update AutoSplitPdfController.java --- .../SPDF/controller/api/misc/AutoSplitPdfController.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java index cf9b6220..4ca45762 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java @@ -64,14 +64,11 @@ public class AutoSplitPdfController { for (int page = 0; page < document.getNumberOfPages(); ++page) { BufferedImage bim = pdfRenderer.renderImageWithDPI(page, 150); String result = decodeQRCode(bim); - System.out.println("result = " + result); if ((QR_CONTENT.equals(result) || QR_CONTENT_OLD.equals(result)) && page != 0) { - System.out.println("page " + (page + 1) + " is QR"); splitDocuments.add(new PDDocument()); } if (!splitDocuments.isEmpty() && !QR_CONTENT.equals(result) && !QR_CONTENT_OLD.equals(result)) { - System.out.println("page " + (page + 1) + " is NOT QR"); splitDocuments.get(splitDocuments.size() - 1).addPage(document.getPage(page)); } else if (page == 0) { PDDocument firstDocument = new PDDocument(); From 589cb8d91fc85f5ccf827a149913fcb025e74298 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 28 Jan 2024 20:11:15 +0000 Subject: [PATCH 26/90] Add files via upload --- src/main/resources/static/images/stamp.svg | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/resources/static/images/stamp.svg diff --git a/src/main/resources/static/images/stamp.svg b/src/main/resources/static/images/stamp.svg new file mode 100644 index 00000000..aa35a6cb --- /dev/null +++ b/src/main/resources/static/images/stamp.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From 3986858adb1fdc3ed166ea21bd177443f3ebfa34 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 28 Jan 2024 20:11:41 +0000 Subject: [PATCH 27/90] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e12cbd33..987f9854 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ plugins { import com.github.jk1.license.render.* group = 'stirling.software' -version = '0.20.0' +version = '0.20.1' sourceCompatibility = '17' repositories { From 746f2d09490dc53787d2935d3e93f6070daef5a7 Mon Sep 17 00:00:00 2001 From: albanobattistella <34811668+albanobattistella@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:18:57 +0100 Subject: [PATCH 28/90] Update messages_it_IT.properties --- src/main/resources/messages_it_IT.properties | 70 ++++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/main/resources/messages_it_IT.properties b/src/main/resources/messages_it_IT.properties index b9d011bf..86485d20 100644 --- a/src/main/resources/messages_it_IT.properties +++ b/src/main/resources/messages_it_IT.properties @@ -44,7 +44,7 @@ blue=Blu custom=Personalizzato WorkInProgess=Lavori in corso, potrebbe non funzionare o essere difettoso, segnalare eventuali problemi! poweredBy=Alimentato da -yes=Yes +yes=Si no=No changedCredsMessage=Credenziali cambiate! notAuthenticatedMessage=Utente non autenticato. @@ -69,7 +69,7 @@ pipelineOptions.header=Configurazione Pipeline pipelineOptions.pipelineNameLabel=Nome della Pipeline pipelineOptions.saveSettings=Salva Impostazioni pipelineOptions.pipelineNamePrompt=Inserisci qui il nome della pipeline -pipelineOptions.selectOperation=Select Operation +pipelineOptions.selectOperation=Seleziona operazione pipelineOptions.addOperationButton=Aggiungi operazione pipelineOptions.pipelineHeader=Pipeline: pipelineOptions.saveButton=Download @@ -236,7 +236,7 @@ ocr.tags=riconoscimento,testo,immagine,scansione,lettura,identificazione,rilevam home.extractImages.title=Estrai immagini home.extractImages.desc=Estrai tutte le immagini da un PDF e salvale come zip. -extractImages.tags=picture,photo,save,archive,zip,capture,grab +extractImages.tags=immagine,photo,save,archive,zip,capture,grab home.pdfToPDFA.title=Converti in PDF/A home.pdfToPDFA.desc=Converti un PDF nel formato PDF/A per archiviazione a lungo termine. @@ -313,7 +313,7 @@ add-page-numbers.tags=impaginare,etichettare,organizzare,indicizzare home.auto-rename.title=Rinomina automaticamente il file PDF home.auto-rename.desc=Rinomina automaticamente un file PDF in base all'intestazione rilevata -auto-rename.tags=arilevamento automatico,basato su intestazione,organizzazione,rietichettatura +auto-rename.tags=rilevamento automatico,basato su intestazione,organizzazione,rietichettatura home.adjust-contrast.title=Regola colori/contrasto home.adjust-contrast.desc=Regola contrasto, saturazione e luminosità di un PDF @@ -386,9 +386,9 @@ home.split-by-sections.title=Dividi PDF per sezioni home.split-by-sections.desc=Dividi ciascuna pagina di un PDF in sezioni orizzontali e verticali più piccole split-by-sections.tags=Dividi sezione, dividi, personalizza -home.AddStampRequest.title=Add Stamp to PDF -home.AddStampRequest.desc=Add text or add image stamps at set locations -AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize +home.AddStampRequest.title=Aggiungi timbro al PDF +home.AddStampRequest.desc=Aggiungi testo o aggiungi timbri immagine nelle posizioni prestabilite +AddStampRequest.tags=Timbro, Aggiungi immagine, Centra immagine, Filigrana, PDF, Incorpora, Personalizza ########################### @@ -466,37 +466,37 @@ HTMLToPDF.header=HTML a PDF HTMLToPDF.help=Accetta file HTML e ZIP contenenti html/css/immagini ecc. richiesti HTMLToPDF.submit=Converti HTMLToPDF.credit=Utilizza WeasyPrint -HTMLToPDF.zoom=Zoom level for displaying the website. -HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) -HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) -HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) -HTMLToPDF.printBackground=Render the background of websites. -HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) -HTMLToPDF.cssMediaType=Change the CSS media type of the page. -HTMLToPDF.none=None -HTMLToPDF.print=Print -HTMLToPDF.screen=Screen +HTMLToPDF.zoom=Livello di zoom per la visualizzazione del sito web. +HTMLToPDF.pageWidth=Larghezza della pagina in centimetri. (Vuoto per impostazione predefinita) +HTMLToPDF.pageHeight=Altezza della pagina in centimetri. (Vuoto per impostazione predefinita) +HTMLToPDF.marginTop=Margine superiore della pagina in millimetri. (Vuoto per impostazione predefinita) +HTMLToPDF.marginBottom=Margine inferiore della pagina in millimetri. (Vuoto per impostazione predefinita) +HTMLToPDF.marginLeft=Margine sinistro della pagina in millimetri. (Vuoto per impostazione predefinita) +HTMLToPDF.marginRight=Margine destro della pagina in millimetri. (Vuoto per impostazione predefinita) +HTMLToPDF.printBackground=Rendering dello sfondo dei siti Web. +HTMLToPDF.defaultHeader=Abilita intestazione predefinita (nome e numero di pagina) +HTMLToPDF.cssMediaType=Cambia il tipo di supporto CSS della pagina. +HTMLToPDF.none=Nessuno +HTMLToPDF.print=Stampa +HTMLToPDF.screen=Schermo #AddStampRequest -AddStampRequest.header=Stamp PDF -AddStampRequest.title=Stamp PDF -AddStampRequest.stampType=Stamp Type -AddStampRequest.stampText=Stamp Text -AddStampRequest.stampImage=Stamp Image -AddStampRequest.alphabet=Alphabet -AddStampRequest.fontSize=Font/Image Size -AddStampRequest.rotation=Rotation -AddStampRequest.opacity=Opacity -AddStampRequest.position=Position -AddStampRequest.overrideX=Override X Coordinate -AddStampRequest.overrideY=Override Y Coordinate -AddStampRequest.customMargin=Custom Margin -AddStampRequest.customColor=Custom Text Color -AddStampRequest.submit=Submit +AddStampRequest.header=Timbro PDF +AddStampRequest.title=Timbro PDF +AddStampRequest.stampType=Tipo di timbro +AddStampRequest.stampText=Testo del timbro +AddStampRequest.stampImage=Immagine del timbro +AddStampRequest.alphabet=Alfabeto +AddStampRequest.fontSize=Dimensione carattere/immagine +AddStampRequest.rotation=Rotazione +AddStampRequest.opacity=Opacità +AddStampRequest.position=Posizione +AddStampRequest.overrideX=Sostituisci la coordinata X +AddStampRequest.overrideY=Sostituisci la coordinata Y +AddStampRequest.customMargin=Margine personalizzato +AddStampRequest.customColor=Colore testo personalizzato +AddStampRequest.submit=Invia #sanitizePDF sanitizePDF.title=Pulire PDF From e77d2847ea89faf5478d8843097b3f1f845f73a0 Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:49:02 +0100 Subject: [PATCH 29/90] add new translations --- src/main/resources/messages_nl_NL.properties | 64 ++++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/main/resources/messages_nl_NL.properties b/src/main/resources/messages_nl_NL.properties index e1202b84..c56e988a 100644 --- a/src/main/resources/messages_nl_NL.properties +++ b/src/main/resources/messages_nl_NL.properties @@ -44,8 +44,8 @@ blue=Blauw custom=Aangepast... WorkInProgess=Werk in uitvoering. Werkt mogelijk niet of bevat fouten. Meld eventuele problemen! poweredBy=Mogelijk gemaakt door -yes=Yes -no=No +yes=Ja +no=Nee changedCredsMessage=Inloggegevens gewijzigd! notAuthenticatedMessage=Gebruiker niet ingelogd. userNotFoundMessage=Gebruiker niet gevonden. @@ -69,7 +69,7 @@ pipelineOptions.header=Pijplijn onfiguratie pipelineOptions.pipelineNameLabel=Pijplijn naam pipelineOptions.saveSettings=Instellingen voor bewerking opslaan pipelineOptions.pipelineNamePrompt=Voer hier de naam van de pijplijn in -pipelineOptions.selectOperation=Select Operation +pipelineOptions.selectOperation=Selecteer bewerking pipelineOptions.addOperationButton=Bewerking toevoegen pipelineOptions.pipelineHeader=Pijplijn: pipelineOptions.saveButton=Downloaden @@ -384,11 +384,11 @@ overlay-pdfs.tags=Overlappen home.split-by-sections.title=PDF in secties splitsen home.split-by-sections.desc=Verdeel elke pagina van een PDF in kleinere horizontale en verticale secties -split-by-sections.tags=Sectoe splitsen, Verdelen, Aanpassen +split-by-sections.tags=Sectie splitsen, Verdelen, Aanpassen -home.AddStampRequest.title=Add Stamp to PDF -home.AddStampRequest.desc=Add text or add image stamps at set locations -AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize +home.AddStampRequest.title=Stempel toevoegen aan PDF +home.AddStampRequest.desc=Voeg tekst of afbeeldingsstempels toe op vaste locaties +AddStampRequest.tags=Stempel, Afbeelding toevoegen, afbeelding centreren, watermerk, PDF, Insluiten, Aanpassen ########################### @@ -467,36 +467,36 @@ HTMLToPDF.help=Accepteert HTML-bestanden en ZIP's die html/css/afbeeldingen etc. HTMLToPDF.submit=Converteren HTMLToPDF.credit=Gebruikt WeasyPrint HTMLToPDF.zoom=Zoom level for displaying the website. -HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) -HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) -HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) -HTMLToPDF.printBackground=Render the background of websites. -HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) -HTMLToPDF.cssMediaType=Change the CSS media type of the page. -HTMLToPDF.none=None +HTMLToPDF.pageWidth=Breedte van de pagina in centimeters. (leeg voor standaard) +HTMLToPDF.pageHeight=Hoogte van de pagina in centimeters. (leeg voor standaard) +HTMLToPDF.marginTop=Marge bovenaan de pagina in millimeters. (leeg voor standaard) +HTMLToPDF.marginBottom=Marge onderaan de pagina in millimeters. (leeg voor standaard) +HTMLToPDF.marginLeft=Marge links van de pagina in millimeters. (leeg voor standaard) +HTMLToPDF.marginRight=Marge rechts van de pagina in millimeters. (leeg voor standaard) +HTMLToPDF.printBackground=De achtergrond van websites weergeven. +HTMLToPDF.defaultHeader=Standaard koptekst weergeven (naam en paginanummer) +HTMLToPDF.cssMediaType=Wijzig het CSS-mediatype van de pagina. +HTMLToPDF.none=Geen HTMLToPDF.print=Print HTMLToPDF.screen=Screen #AddStampRequest -AddStampRequest.header=Stamp PDF -AddStampRequest.title=Stamp PDF -AddStampRequest.stampType=Stamp Type -AddStampRequest.stampText=Stamp Text -AddStampRequest.stampImage=Stamp Image -AddStampRequest.alphabet=Alphabet -AddStampRequest.fontSize=Font/Image Size -AddStampRequest.rotation=Rotation -AddStampRequest.opacity=Opacity -AddStampRequest.position=Position -AddStampRequest.overrideX=Override X Coordinate -AddStampRequest.overrideY=Override Y Coordinate -AddStampRequest.customMargin=Custom Margin -AddStampRequest.customColor=Custom Text Color -AddStampRequest.submit=Submit +AddStampRequest.header=Stempel PDF +AddStampRequest.title=Stempel PDF +AddStampRequest.stampType=Soort stempel +AddStampRequest.stampText=Stempel tekst +AddStampRequest.stampImage=Stempel afbeelding +AddStampRequest.alphabet=Alfabet +AddStampRequest.fontSize=Tekst/afbeelding grootte +AddStampRequest.rotation=Rotatie +AddStampRequest.opacity=Transparantie +AddStampRequest.position=Positie +AddStampRequest.overrideX=X coördinaat overschrijven +AddStampRequest.overrideY=Y coördinaat overschrijven +AddStampRequest.customMargin=Aangepate marge +AddStampRequest.customColor=Aangepaste tekstkleur +AddStampRequest.submit=Indienen #sanitizePDF sanitizePDF.title=PDF opschonen From 53afb865c53b0a000afb50a9932f28e2563b5142 Mon Sep 17 00:00:00 2001 From: sbplat <71648843+sbplat@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:23:58 -0500 Subject: [PATCH 30/90] refactor: replace ImageFinder with getAllImages using strategy behind ExtractImagesController --- .../api/misc/AutoSplitPdfController.java | 4 +- .../api/pipeline/ApiDocService.java | 5 +- .../software/SPDF/pdf/ImageFinder.java | 131 ------------------ .../software/SPDF/utils/PdfUtils.java | 29 +++- 4 files changed, 28 insertions(+), 141 deletions(-) delete mode 100644 src/main/java/stirling/software/SPDF/pdf/ImageFinder.java diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java index 4ca45762..8b095358 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java @@ -68,7 +68,9 @@ public class AutoSplitPdfController { splitDocuments.add(new PDDocument()); } - if (!splitDocuments.isEmpty() && !QR_CONTENT.equals(result) && !QR_CONTENT_OLD.equals(result)) { + if (!splitDocuments.isEmpty() + && !QR_CONTENT.equals(result) + && !QR_CONTENT_OLD.equals(result)) { splitDocuments.get(splitDocuments.size() - 1).addPage(document.getPage(page)); } else if (page == 0) { PDDocument firstDocument = new PDDocument(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java index 27240b6f..02c37e5c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/ApiDocService.java @@ -63,10 +63,7 @@ public class ApiDocService { outputToFileTypes.put("PPT", Arrays.asList("ppt", "pptx", "odp")); outputToFileTypes.put("XML", Arrays.asList("xml", "xsd", "xsl")); outputToFileTypes.put( - "BOOK", - Arrays.asList( - "epub", "mobi", "azw3", "fb2", "txt", - "docx")); + "BOOK", Arrays.asList("epub", "mobi", "azw3", "fb2", "txt", "docx")); // type. } diff --git a/src/main/java/stirling/software/SPDF/pdf/ImageFinder.java b/src/main/java/stirling/software/SPDF/pdf/ImageFinder.java deleted file mode 100644 index a710dbd5..00000000 --- a/src/main/java/stirling/software/SPDF/pdf/ImageFinder.java +++ /dev/null @@ -1,131 +0,0 @@ -package stirling.software.SPDF.pdf; - -import java.awt.geom.Point2D; -import java.io.IOException; -import java.util.List; - -import org.apache.pdfbox.contentstream.operator.Operator; -import org.apache.pdfbox.contentstream.operator.OperatorName; -import org.apache.pdfbox.cos.COSBase; -import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.pdmodel.PDPage; -import org.apache.pdfbox.pdmodel.graphics.PDXObject; -import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject; -import org.apache.pdfbox.pdmodel.graphics.image.PDImage; -import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject; - -public class ImageFinder extends org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine { - private boolean hasImages = false; - - public ImageFinder(PDPage page) { - super(page); - } - - public boolean hasImages() { - return hasImages; - } - - @Override - protected void processOperator(Operator operator, List operands) throws IOException { - String operation = operator.getName(); - if (operation.equals(OperatorName.DRAW_OBJECT)) { - COSBase base = operands.get(0); - if (base instanceof COSName) { - COSName objectName = (COSName) base; - PDXObject xobject = getResources().getXObject(objectName); - if (xobject instanceof PDImageXObject) { - hasImages = true; - } else if (xobject instanceof PDFormXObject) { - PDFormXObject form = (PDFormXObject) xobject; - ImageFinder innerFinder = new ImageFinder(getPage()); - innerFinder.processPage(getPage()); - if (innerFinder.hasImages()) { - hasImages = true; - } - } - } - } - super.processOperator(operator, operands); - } - - @Override - public void appendRectangle(Point2D p0, Point2D p1, Point2D p2, Point2D p3) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void drawImage(PDImage pdImage) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void clip(int windingRule) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void moveTo(float x, float y) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void lineTo(float x, float y) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) - throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public Point2D getCurrentPoint() throws IOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void closePath() throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void endPath() throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void strokePath() throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void fillPath(int windingRule) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void fillAndStrokePath(int windingRule) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public void shadingFill(COSName shadingName) throws IOException { - // TODO Auto-generated method stub - - } - - // ... rest of the overridden methods -} diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index 426fc78d..1676ce85 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -2,8 +2,10 @@ package stirling.software.SPDF.utils; import java.awt.Graphics; import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -16,11 +18,15 @@ import javax.imageio.ImageWriter; import javax.imageio.stream.ImageOutputStream; import org.apache.pdfbox.Loader; +import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDPageContentStream; import org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode; +import org.apache.pdfbox.pdmodel.PDResources; import org.apache.pdfbox.pdmodel.common.PDRectangle; +import org.apache.pdfbox.pdmodel.graphics.PDXObject; +import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject; import org.apache.pdfbox.pdmodel.graphics.image.JPEGFactory; import org.apache.pdfbox.pdmodel.graphics.image.LosslessFactory; import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject; @@ -31,8 +37,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.multipart.MultipartFile; -import stirling.software.SPDF.pdf.ImageFinder; - public class PdfUtils { private static final Logger logger = LoggerFactory.getLogger(PdfUtils.class); @@ -62,6 +66,23 @@ public class PdfUtils { } } + public static List getAllImages(PDResources resources) throws IOException { + List images = new ArrayList<>(); + + for (COSName name : resources.getXObjectNames()) { + PDXObject object = resources.getXObject(name); + + if (object instanceof PDImageXObject) { + images.add(((PDImageXObject) object).getImage()); + + } else if (object instanceof PDFormXObject) { + images.addAll(getAllImages(((PDFormXObject) object).getResources())); + } + } + + return images; + } + public static boolean hasImages(PDDocument document, String pagesToCheck) throws IOException { String[] pageOrderArr = pagesToCheck.split(","); List pageList = @@ -94,9 +115,7 @@ public class PdfUtils { } public static boolean hasImagesOnPage(PDPage page) throws IOException { - ImageFinder imageFinder = new ImageFinder(page); - imageFinder.processPage(page); - return imageFinder.hasImages(); + return getAllImages(page.getResources()).size() > 0; } public static boolean hasTextOnPage(PDPage page, String phrase) throws IOException { From b00f8c80ecc908b8e12e687f42939232d16b6056 Mon Sep 17 00:00:00 2001 From: ProvaTeams Date: Mon, 29 Jan 2024 19:13:57 +0100 Subject: [PATCH 31/90] Add required attribute to input file --- src/main/resources/templates/fragments/common.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/fragments/common.html b/src/main/resources/templates/fragments/common.html index 924140e6..a07f483d 100644 --- a/src/main/resources/templates/fragments/common.html +++ b/src/main/resources/templates/fragments/common.html @@ -120,7 +120,7 @@ data-bs-files-selected=#{filesSelected}, data-bs-pdf-prompt=#{pdfPrompt}">
- +
From 2d37c707e2192550d57d2839f60725d1a7267b8b Mon Sep 17 00:00:00 2001 From: sbplat <71648843+sbplat@users.noreply.github.com> Date: Wed, 31 Jan 2024 00:54:51 -0500 Subject: [PATCH 32/90] feat: support '\n' literal in add watermark --- .../api/security/WatermarkController.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java index 7bfb4c85..6630a200 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java @@ -155,9 +155,16 @@ public class WatermarkController { contentStream.setFont(font, fontSize); contentStream.setNonStrokingColor(Color.LIGHT_GRAY); + String[] textLines = watermarkText.split("\\\\n"); + float maxLineWidth = 0; + + for (int i = 0; i < textLines.length; ++i) { + maxLineWidth = Math.max(maxLineWidth, font.getStringWidth(textLines[i])); + } + // Set size and location of text watermark - float watermarkWidth = widthSpacer + font.getStringWidth(watermarkText) * fontSize / 1000; - float watermarkHeight = heightSpacer + fontSize; + float watermarkWidth = widthSpacer + maxLineWidth * fontSize / 1000; + float watermarkHeight = heightSpacer + fontSize * textLines.length; float pageWidth = page.getMediaBox().getWidth(); float pageHeight = page.getMediaBox().getHeight(); int watermarkRows = (int) (pageHeight / watermarkHeight + 1); @@ -172,7 +179,12 @@ public class WatermarkController { (float) Math.toRadians(rotation), j * watermarkWidth, i * watermarkHeight)); - contentStream.showText(watermarkText); + + for (int k = 0; k < textLines.length; ++k) { + contentStream.showText(textLines[k]); + contentStream.newLineAtOffset(0, -fontSize); + } + contentStream.endText(); } } From 55020d45f8cf3dab5dd886d9bb3e4ff930a10e33 Mon Sep 17 00:00:00 2001 From: ProvaTeams <142001287+ProvaTeams@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:09:16 +0000 Subject: [PATCH 33/90] Using the flag logic --- src/main/resources/templates/fragments/common.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/fragments/common.html b/src/main/resources/templates/fragments/common.html index a07f483d..cd2d47b7 100644 --- a/src/main/resources/templates/fragments/common.html +++ b/src/main/resources/templates/fragments/common.html @@ -120,7 +120,7 @@ data-bs-files-selected=#{filesSelected}, data-bs-pdf-prompt=#{pdfPrompt}">
- +
From 903faadff367e948cc0d97b99fb6e495357dac0b Mon Sep 17 00:00:00 2001 From: sbplat <71648843+sbplat@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:04:40 -0500 Subject: [PATCH 34/90] misc: update pull request template --- .github/pull_request_template.md | 18 ++++++++++++++++-- .github/workflows/pull_request_template.md | 3 --- 2 files changed, 16 insertions(+), 5 deletions(-) delete mode 100644 .github/workflows/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e73caa3f..1fca1966 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,18 @@ -# License Agreement for Contributions -By submitting this pull request, I acknowledge and agree that my contributions will be included in Stirling-PDF and that they can be relicensed in the future under MPL 2.0 (Mozilla Public License Version 2.0) license. +# Description + +Please provide a summary of the changes, including relevant motivation and context. + +Closes #(issue_number) + +## Checklist: + +- [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] My changes generate no new warnings + +## Contributor License Agreement + +By submitting this pull request, I acknowledge and agree that my contributions will be included in Stirling-PDF and that they can be relicensed in the future under the MPL 2.0 (Mozilla Public License Version 2.0) license. (This does not change the general open-source nature of Stirling-PDF, simply moving from one license to another license) diff --git a/.github/workflows/pull_request_template.md b/.github/workflows/pull_request_template.md deleted file mode 100644 index bc8f5d04..00000000 --- a/.github/workflows/pull_request_template.md +++ /dev/null @@ -1,3 +0,0 @@ -# License Agreement for Contributions -By submitting this pull request, I acknowledge and agree that my contributions will be included in Stirling-PDF and that they can be relicensed in the future under MPL 2.0 (Mozilla Public License Version 2.0) license. -(This does not change the open-source nature of Stirling-PDF, simply moving from one license to another license) From b043e666ae896b055764af12ddebd82bf3f1f651 Mon Sep 17 00:00:00 2001 From: Zoey Date: Sun, 31 Dec 2023 15:54:34 +0100 Subject: [PATCH 35/90] switch images to alpine Signed-off-by: Zoey --- Dockerfile | 33 ++++++++------------ Dockerfile-lite | 70 ++++++++++++++++++++----------------------- Dockerfile-ultra-lite | 39 ++++++++++++------------ DockerfileBase | 55 +++++++++++----------------------- HowToUseOCR.md | 6 ++-- LocalRunGuide.md | 2 +- README.md | 4 +-- scripts/init.sh | 12 +++++--- 8 files changed, 96 insertions(+), 125 deletions(-) diff --git a/Dockerfile b/Dockerfile index f0eb592c..63bbc6b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,37 +11,30 @@ ENV DOCKER_ENABLE_SECURITY=false \ # PUID=1000 \ # PGID=1000 \ # UMASK=022 \ - + +# Copy necessary files +COPY scripts /scripts +COPY pipeline /pipeline +COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto +COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto +COPY build/libs/*.jar app.jar # Create user and group ##RUN groupadd -g $PGID stirlingpdfgroup && \ ## useradd -u $PUID -g stirlingpdfgroup -s /bin/sh stirlingpdfuser && \ -## mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME - +## mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME && \ # Set up necessary directories and permissions -RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /usr/share/tesseract-ocr /configs /logs /customFiles /pipeline /pipeline/defaultWebUIConfigs /pipeline/watchedFolders /pipeline/finishedFolders +RUN mkdir /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders && \ ##&& \ ## chown -R stirlingpdfuser:stirlingpdfgroup /scripts /usr/share/fonts/opentype/noto /usr/share/tesseract-ocr /configs /customFiles && \ -## chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/tesseract-ocr-original - -# Copy necessary files -COPY ./scripts/* /scripts/ -COPY ./pipeline/ /pipeline/ -COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/ -COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/ -COPY build/libs/*.jar app.jar - +## chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/tesseract-ocr-original && \ # Set font cache and permissions -RUN fc-cache -f -v && chmod +x /scripts/* - -##&& \ + fc-cache -f -v && \ + chmod +x /scripts/* ## chown stirlingpdfuser:stirlingpdfgroup /app.jar && \ ## chmod +x /scripts/init.sh -# Expose necessary ports -EXPOSE 8080 - # Set user and run command ##USER stirlingpdfuser -ENTRYPOINT ["/scripts/init.sh"] +ENTRYPOINT ["tini", "--", "/scripts/init.sh"] CMD ["java", "-Dfile.encoding=UTF-8", "-jar", "/app.jar"] diff --git a/Dockerfile-lite b/Dockerfile-lite index 054c7639..982a53e7 100644 --- a/Dockerfile-lite +++ b/Dockerfile-lite @@ -1,65 +1,59 @@ -# Build jbig2enc in a separate stage -FROM bellsoft/liberica-openjdk-debian:17 +# use alpine +FROM alpine:latest ARG VERSION_TAG -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - libreoffice-core \ - libreoffice-common \ - libreoffice-writer \ - libreoffice-calc \ - libreoffice-impress \ - unoconv && \ - rm -rf /var/lib/apt/lists/* - - # Set Environment Variables ENV DOCKER_ENABLE_SECURITY=false \ HOME=/home/stirlingpdfuser \ VERSION_TAG=$VERSION_TAG \ JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -XX:MaxRAMPercentage=75" -# PUID=1000 \ +# PUID=1000 \ # PGID=1000 \ # UMASK=022 \ +# Copy necessary files +COPY scripts/download-security-jar.sh /scripts/download-security-jar.sh +COPY scripts/init-without-ocr.sh /scripts/init-without-ocr.sh +COPY pipeline /pipeline +COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto +COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto +COPY build/libs/*.jar app.jar + +RUN apk add --no-cache \ + ca-certificates \ + tzdata \ + tini \ + bash \ + curl \ + openjdk17-jre \ +# Doc conversion + libreoffice-common \ + libreoffice-writer \ + libreoffice-calc \ + libreoffice-impress \ +# python and pip + python3 && \ + wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ +# uno unoconv and HTML + pip install --break-system-packages --no-cache-dir --upgrade uno unoconv WeasyPrint && \ # Create user and group #RUN groupadd -g $PGID stirlingpdfgroup && \ # useradd -u $PUID -g stirlingpdfgroup -s /bin/sh stirlingpdfuser && \ # mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME - # Set up necessary directories and permissions -RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /configs /customFiles /logs /pipeline /pipeline/defaultWebUIConfigs /pipeline/watchedFolders /pipeline/finishedFolders - + mkdir /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders && \ # chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/fonts/opentype/noto /configs /customFiles - -# Copy necessary files -COPY ./scripts/download-security-jar.sh /scripts/download-security-jar.sh -COPY ./scripts/init-without-ocr.sh /scripts/init-without-ocr.sh -COPY ./pipeline/ /pipeline/ -COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/ -COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/ -COPY build/libs/*.jar app.jar - # Set font cache and permissions -RUN fc-cache -f -v && \ -chmod +x /scripts/init-without-ocr.sh && \ -chmod +x /scripts/download-security-jar.sh - - + fc-cache -f -v && \ + chmod +x /scripts/*.sh # chown stirlingpdfuser:stirlingpdfgroup /app.jar - - - -# Expose the application port -EXPOSE 8080 - # Set environment variables ENV ENDPOINTS_GROUPS_TO_REMOVE=Python,OpenCV,OCRmyPDF ENV DOCKER_ENABLE_SECURITY=false # Run the application #USER stirlingpdfuser -ENTRYPOINT ["/scripts/init-without-ocr.sh"] +ENTRYPOINT ["tini", "--", "/scripts/init-without-ocr.sh"] CMD ["java", "-Dfile.encoding=UTF-8", "-jar", "/app.jar"] diff --git a/Dockerfile-ultra-lite b/Dockerfile-ultra-lite index d77c1b94..38eca953 100644 --- a/Dockerfile-ultra-lite +++ b/Dockerfile-ultra-lite @@ -1,5 +1,5 @@ -# Build jbig2enc in a separate stage -FROM bellsoft/liberica-openjdk-alpine:17 +# use alpine +FROM alpine:latest ARG VERSION_TAG @@ -8,39 +8,38 @@ ENV DOCKER_ENABLE_SECURITY=false \ HOME=/home/stirlingpdfuser \ VERSION_TAG=$VERSION_TAG \ JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -XX:MaxRAMPercentage=75" -# PUID=1000 \ +# PUID=1000 \ # PGID=1000 \ # UMASK=022 \ +# Copy necessary files +COPY scripts/download-security-jar.sh /scripts/download-security-jar.sh +COPY scripts/init-without-ocr.sh /scripts/init-without-ocr.sh +COPY pipeline /pipeline +COPY build/libs/*.jar app.jar + # Create user and group using Alpine's addgroup and adduser #RUN addgroup -g $PGID stirlingpdfgroup && \ # adduser -u $PUID -G stirlingpdfgroup -s /bin/sh -D stirlingpdfuser && \ # mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME - # Set up necessary directories and permissions #RUN mkdir -p /scripts /configs /customFiles && \ -# chown -R stirlingpdfuser:stirlingpdfgroup /scripts /configs /customFiles /logs /pipeline /pipeline/defaultWebUIConfigs /pipeline/watchedFolders /pipeline/finishedFolders - -RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /configs /customFiles -COPY ./scripts/download-security-jar.sh /scripts/download-security-jar.sh -COPY ./scripts/init-without-ocr.sh /scripts/init-without-ocr.sh -COPY ./pipeline/ /pipeline/ -COPY build/libs/*.jar app.jar - +# chown -R stirlingpdfuser:stirlingpdfgroup /scripts /configs /customFiles /logs /pipeline /pipeline/defaultWebUIConfigs /pipeline/watchedFolders /pipeline/finishedFolders +RUN mkdir /configs /logs /customFiles && \ # Set font cache and permissions #RUN chown stirlingpdfuser:stirlingpdfgroup /app.jar - -RUN chmod +x /scripts/init-without-ocr.sh && \ -chmod +x /scripts/download-security-jar.sh && \ -apk add --no-cache curl - -# Expose the application port -EXPOSE 8080 + chmod +x /scripts/*.sh && \ + apk add --no-cache \ + ca-certificates \ + tzdata \ + tini \ + bash \ + curl # Set environment variables ENV ENDPOINTS_GROUPS_TO_REMOVE=CLI -ENTRYPOINT ["/scripts/init-without-ocr.sh"] +ENTRYPOINT ["tini", "--", "/scripts/init-without-ocr.sh"] # Run the application CMD ["java", "-Dfile.encoding=UTF-8", "-jar", "/app.jar"] diff --git a/DockerfileBase b/DockerfileBase index b37050c7..06832347 100644 --- a/DockerfileBase +++ b/DockerfileBase @@ -1,43 +1,24 @@ # Main stage -FROM ubuntu:latest AS base - - +FROM alpine:3.19.0 # JDK for app -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - openjdk-17-jre && \ - rm -rf /var/lib/apt/lists/* - +RUN apk add --no-cache \ + ca-certificates \ + tzdata \ + tini \ + bash \ + curl \ + openjdk17-jre \ # Doc conversion -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - libreoffice-core \ - libreoffice-common \ - libreoffice-writer \ - libreoffice-calc \ - libreoffice-impress \ - python3-uno \ - curl \ - unoconv && \ - rm -rf /var/lib/apt/lists/* - - + libreoffice \ # OCR MY PDF (unpaper for descew and other advanced featues) -RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common gnupg2 && \ -add-apt-repository ppa:alex-p/tesseract-ocr5 && apt install -y --no-install-recommends tesseract-ocr && \ -apt-get update && \ - apt-get install -y --no-install-recommends \ - ghostscript \ - python3-pip \ ocrmypdf \ - unpaper && \ - rm -rf /var/lib/apt/lists/* && \ - mv /usr/share/tesseract-ocr /usr/share/tesseract-ocr-original && \ - pip install --no-cache-dir --upgrade pip && \ - pip install --no-cache-dir --upgrade ocrmypdf && \ - pip install --no-cache-dir --upgrade pillow==10.0.1 reportlab==3.6.13 wheel==0.38.1 setuptools==65.5.1 pyjwt==2.4.0 cryptography==39.0.1 - - -#CV and HTML -RUN pip install --no-cache-dir opencv-python-headless WeasyPrint + tesseract-ocr-data-eng \ +# CV + py3-opencv \ +# python3/pip + python3 && \ + wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ +# uno unoconv and HTML + pip install --break-system-packages --no-cache-dir --upgrade unoconv WeasyPrint && \ + mv /usr/share/tessdata /usr/share/tessdata-original diff --git a/HowToUseOCR.md b/HowToUseOCR.md index d83d0fd2..8fdf8fe4 100644 --- a/HowToUseOCR.md +++ b/HowToUseOCR.md @@ -21,7 +21,7 @@ Depending on your requirements, you can choose the appropriate language pack for ### Installing Language Packs 1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need. -2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tesseract-ocr/5/tessdata` (Debian) or `/usr/share/tesseract/tessdata` (Fedora) +2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata` # DO NOT REMOVE EXISTING ENG.TRAINEDDATA, IT'S REQUIRED. @@ -37,14 +37,14 @@ services: your_service_name: image: your_docker_image_name volumes: - - /location/of/trainingData:/usr/share/tesseract-ocr/5/tessdata + - /location/of/trainingData:/usr/share/tessdata ``` #### Docker run Add the following to your existing docker run command ```bash --v /location/of/trainingData:/usr/share/tesseract-ocr/5/tessdata +-v /location/of/trainingData:/usr/share/tessdata ``` #### Non-Docker diff --git a/LocalRunGuide.md b/LocalRunGuide.md index 824c1ae7..75a53b80 100644 --- a/LocalRunGuide.md +++ b/LocalRunGuide.md @@ -139,7 +139,7 @@ Easiest is to use the langpacks provided by your repositories. Skip the other st Manual: 1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need. -2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tesseract-ocr/5/tessdata` +2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata` 3. Please view [OCRmyPDF install guide](https://ocrmypdf.readthedocs.io/en/latest/installation.html) for more info. **IMPORTANT:** DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED. diff --git a/README.md b/README.md index e8814b80..5876a7e2 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Docker Run ```bash docker run -d \ -p 8080:8080 \ - -v /location/of/trainingData:/usr/share/tesseract-ocr/5/tessdata \ + -v /location/of/trainingData:/usr/share/tessdata \ -v /location/of/extraConfigs:/configs \ -v /location/of/logs:/logs \ -e DOCKER_ENABLE_SECURITY=false \ @@ -131,7 +131,7 @@ services: ports: - '8080:8080' volumes: - - /location/of/trainingData:/usr/share/tesseract-ocr/5/tessdata #Required for extra OCR languages + - /location/of/trainingData:/usr/share/tessdata #Required for extra OCR languages - /location/of/extraConfigs:/configs # - /location/of/customFiles:/customFiles/ # - /location/of/logs:/logs/ diff --git a/scripts/init.sh b/scripts/init.sh index 8f1f96db..7f5b19f0 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -3,10 +3,14 @@ # Copy the original tesseract-ocr files to the volume directory without overwriting existing files echo "Copying original files without overwriting existing files" mkdir -p /usr/share/tesseract-ocr -cp -rn /usr/share/tesseract-ocr-original/* /usr/share/tesseract-ocr +cp -rn /usr/share/tesseract-ocr-original/* /usr/share/tesseract-ocr -if [ -d /usr/share/tesseract-ocr/4.00/tessdata ]; then - cp -r /usr/share/tesseract-ocr/4.00/tessdata/* /usr/share/tesseract-ocr/5/tessdata/ || true; +if [ -d /usr/share/tesseract-ocr/4.00/tessdata ]; then + cp -r /usr/share/tesseract-ocr/4.00/tessdata/* /usr/share/tessdata || true; +fi + +if [ -d /usr/share/tesseract-ocr/5/tessdata ]; then + cp -r /usr/share/tesseract-ocr/5/tessdata/* /usr/share/tessdata || true; fi # Check if TESSERACT_LANGS environment variable is set and is not empty @@ -23,4 +27,4 @@ fi /scripts/download-security-jar.sh # Run the main command -exec "$@" \ No newline at end of file +exec "$@" From aaaf3ffe34290febc582f3ac4ab02adeaec3af4a Mon Sep 17 00:00:00 2001 From: Zoey Date: Sun, 31 Dec 2023 17:14:55 +0100 Subject: [PATCH 36/90] fix some things --- Dockerfile-lite | 9 +++------ Dockerfile-ultra-lite | 5 +++-- scripts/init.sh | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile-lite b/Dockerfile-lite index 982a53e7..e4a36ec4 100644 --- a/Dockerfile-lite +++ b/Dockerfile-lite @@ -1,5 +1,5 @@ # use alpine -FROM alpine:latest +FROM alpine:3.19.0 ARG VERSION_TAG @@ -28,15 +28,12 @@ RUN apk add --no-cache \ curl \ openjdk17-jre \ # Doc conversion - libreoffice-common \ - libreoffice-writer \ - libreoffice-calc \ - libreoffice-impress \ + libreoffice \ # python and pip python3 && \ wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ # uno unoconv and HTML - pip install --break-system-packages --no-cache-dir --upgrade uno unoconv WeasyPrint && \ + pip install --break-system-packages --no-cache-dir --upgrade unoconv WeasyPrint && \ # Create user and group #RUN groupadd -g $PGID stirlingpdfgroup && \ # useradd -u $PUID -g stirlingpdfgroup -s /bin/sh stirlingpdfuser && \ diff --git a/Dockerfile-ultra-lite b/Dockerfile-ultra-lite index 38eca953..f6c73df0 100644 --- a/Dockerfile-ultra-lite +++ b/Dockerfile-ultra-lite @@ -1,5 +1,5 @@ # use alpine -FROM alpine:latest +FROM alpine:3.19.0 ARG VERSION_TAG @@ -34,7 +34,8 @@ RUN mkdir /configs /logs /customFiles && \ tzdata \ tini \ bash \ - curl + curl \ + openjdk17-jre # Set environment variables ENV ENDPOINTS_GROUPS_TO_REMOVE=CLI diff --git a/scripts/init.sh b/scripts/init.sh index 7f5b19f0..ea8fd359 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -2,8 +2,8 @@ # Copy the original tesseract-ocr files to the volume directory without overwriting existing files echo "Copying original files without overwriting existing files" -mkdir -p /usr/share/tesseract-ocr -cp -rn /usr/share/tesseract-ocr-original/* /usr/share/tesseract-ocr +mkdir -p /usr/share/tessdata +cp -rn /usr/share/tessdata-original/* /usr/share/tessdata if [ -d /usr/share/tesseract-ocr/4.00/tessdata ]; then cp -r /usr/share/tesseract-ocr/4.00/tessdata/* /usr/share/tessdata || true; From 5afcbdbc8b94962b5cbcab633d06e0f4e4751a8a Mon Sep 17 00:00:00 2001 From: Zoey Date: Wed, 10 Jan 2024 22:56:30 +0100 Subject: [PATCH 37/90] use patched libreoffice version --- Dockerfile-lite | 5 +++-- DockerfileBase | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile-lite b/Dockerfile-lite index e4a36ec4..7784d303 100644 --- a/Dockerfile-lite +++ b/Dockerfile-lite @@ -26,10 +26,11 @@ RUN apk add --no-cache \ tini \ bash \ curl \ - openjdk17-jre \ + openjdk17-jre && \ # Doc conversion - libreoffice \ + apk add --no-cache libreoffice --repository http://dl-cdn.alpinelinux.org/alpine/edge/community && \ # python and pip + apk add --no-cache \ python3 && \ wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ # uno unoconv and HTML diff --git a/DockerfileBase b/DockerfileBase index 06832347..fec16f9b 100644 --- a/DockerfileBase +++ b/DockerfileBase @@ -8,10 +8,11 @@ RUN apk add --no-cache \ tini \ bash \ curl \ - openjdk17-jre \ + openjdk17-jre && \ # Doc conversion - libreoffice \ + apk add --no-cache libreoffice --repository http://dl-cdn.alpinelinux.org/alpine/edge/community && \ # OCR MY PDF (unpaper for descew and other advanced featues) + apk add --no-cache \ ocrmypdf \ tesseract-ocr-data-eng \ # CV From e560028097f648434731af1a74b8deb1451ff7a8 Mon Sep 17 00:00:00 2001 From: Zoey Date: Wed, 31 Jan 2024 20:57:34 +0100 Subject: [PATCH 38/90] Update Dockerfile-lite --- Dockerfile-lite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile-lite b/Dockerfile-lite index 7784d303..1f41ccd6 100644 --- a/Dockerfile-lite +++ b/Dockerfile-lite @@ -48,7 +48,7 @@ RUN apk add --no-cache \ # chown stirlingpdfuser:stirlingpdfgroup /app.jar # Set environment variables -ENV ENDPOINTS_GROUPS_TO_REMOVE=Python,OpenCV,OCRmyPDF +ENV ENDPOINTS_GROUPS_TO_REMOVE=OpenCV,OCRmyPDF ENV DOCKER_ENABLE_SECURITY=false # Run the application From 3debc1b0dfc35cad2e494385c07b636ffa49f5d3 Mon Sep 17 00:00:00 2001 From: Zoey Date: Wed, 31 Jan 2024 20:59:07 +0100 Subject: [PATCH 39/90] add @testing (1/3) --- DockerfileBase | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DockerfileBase b/DockerfileBase index fec16f9b..fd34ddf9 100644 --- a/DockerfileBase +++ b/DockerfileBase @@ -22,4 +22,7 @@ RUN apk add --no-cache \ wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ # uno unoconv and HTML pip install --break-system-packages --no-cache-dir --upgrade unoconv WeasyPrint && \ - mv /usr/share/tessdata /usr/share/tessdata-original + mv /usr/share/tessdata /usr/share/tessdata-original && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories From bb08a632960003dc50b7391c6c679f82da1a127f Mon Sep 17 00:00:00 2001 From: Zoey Date: Wed, 31 Jan 2024 20:59:22 +0100 Subject: [PATCH 40/90] add @testing (2/3) --- Dockerfile-ultra-lite | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile-ultra-lite b/Dockerfile-ultra-lite index f6c73df0..e01debb0 100644 --- a/Dockerfile-ultra-lite +++ b/Dockerfile-ultra-lite @@ -35,7 +35,10 @@ RUN mkdir /configs /logs /customFiles && \ tini \ bash \ curl \ - openjdk17-jre + openjdk17-jre && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories # Set environment variables ENV ENDPOINTS_GROUPS_TO_REMOVE=CLI From d190ae0cf3fc622333227495e6d9fa31bd8228a2 Mon Sep 17 00:00:00 2001 From: Zoey Date: Wed, 31 Jan 2024 20:59:43 +0100 Subject: [PATCH 41/90] add @testing (3/3) --- Dockerfile-lite | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile-lite b/Dockerfile-lite index 1f41ccd6..979d97de 100644 --- a/Dockerfile-lite +++ b/Dockerfile-lite @@ -44,7 +44,10 @@ RUN apk add --no-cache \ # chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/fonts/opentype/noto /configs /customFiles # Set font cache and permissions fc-cache -f -v && \ - chmod +x /scripts/*.sh + chmod +x /scripts/*.sh && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories # chown stirlingpdfuser:stirlingpdfgroup /app.jar # Set environment variables From bfee745ccaa7f53ef27eb0151fdcd9395024eadd Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:40:36 +0000 Subject: [PATCH 42/90] Update build.gradle --- build.gradle | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 987f9854..af6a3092 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'org.springframework.boot' version '3.2.1' + id 'org.springframework.boot' version '3.2.2' id 'io.spring.dependency-management' version '1.1.3' id 'org.springdoc.openapi-gradle-plugin' version '1.8.0' id "io.swagger.swaggerhub" version "1.3.2" @@ -92,19 +92,19 @@ dependencies { implementation 'org.springframework:spring-webmvc:6.1.2' implementation 'org.yaml:snakeyaml:2.2' - implementation 'org.springframework.boot:spring-boot-starter-web:3.2.1' - implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.2.1' + implementation 'org.springframework.boot:spring-boot-starter-web:3.2.2' + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.2.2' if (System.getenv('DOCKER_ENABLE_SECURITY') != 'false') { - implementation 'org.springframework.boot:spring-boot-starter-security:3.2.1' + implementation 'org.springframework.boot:spring-boot-starter-security:3.2.2' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.1.2.RELEASE' - implementation "org.springframework.boot:spring-boot-starter-data-jpa:3.2.1" + implementation "org.springframework.boot:spring-boot-starter-data-jpa:3.2.2" //2.2.x requires rebuild of DB file.. need migration path implementation "com.h2database:h2:2.1.214" } - testImplementation 'org.springframework.boot:spring-boot-starter-test:3.2.1' + testImplementation 'org.springframework.boot:spring-boot-starter-test:3.2.2' // Batik implementation 'org.apache.xmlgraphics:batik-all:1.17' @@ -147,8 +147,8 @@ dependencies { implementation 'org.bouncycastle:bcprov-jdk18on:1.77' implementation 'org.bouncycastle:bcpkix-jdk18on:1.77' - implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'io.micrometer:micrometer-core' + implementation 'org.springframework.boot:spring-boot-starter-actuator:3.2.2' + implementation 'io.micrometer:micrometer-core:1.12.2' implementation group: 'com.google.zxing', name: 'core', version: '3.5.2' // https://mvnrepository.com/artifact/org.commonmark/commonmark implementation 'org.commonmark:commonmark:0.21.0' @@ -156,7 +156,7 @@ dependencies { // https://mvnrepository.com/artifact/com.github.vladimir-bukhtoyarov/bucket4j-core implementation 'com.github.vladimir-bukhtoyarov:bucket4j-core:7.6.0' - developmentOnly("org.springframework.boot:spring-boot-devtools") + developmentOnly("org.springframework.boot:spring-boot-devtools:3.2.2") compileOnly 'org.projectlombok:lombok:1.18.30' annotationProcessor 'org.projectlombok:lombok:1.18.28' } From 2deb40bb6daaa93f983965c72d1f96adb84836ba Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:41:13 +0000 Subject: [PATCH 43/90] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index af6a3092..694b7fd4 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'org.springdoc.openapi-gradle-plugin' version '1.8.0' id "io.swagger.swaggerhub" version "1.3.2" id 'edu.sc.seis.launch4j' version '3.0.5' - id 'com.diffplug.spotless' version '6.23.3' + id 'com.diffplug.spotless' version '6.25.0' id 'com.github.jk1.dependency-license-report' version '2.5' } From e20f4fe31ac502e74a43d15c791968a256a2f61d Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:41:49 +0000 Subject: [PATCH 44/90] Introduced protections against "zip slip" attacks --- .../SPDF/controller/api/pipeline/PipelineProcessor.java | 3 ++- src/main/java/stirling/software/SPDF/utils/FileToPdf.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java index 5ff6842c..d84ea3c5 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.pipeline; +import io.github.pixee.security.ZipSecurity; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -356,7 +357,7 @@ public class PipelineProcessor { List unzippedFiles = new ArrayList<>(); try (ByteArrayInputStream bais = new ByteArrayInputStream(data); - ZipInputStream zis = new ZipInputStream(bais)) { + ZipInputStream zis = ZipSecurity.createHardenedInputStream(bais)) { ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { diff --git a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java index bdf3ec61..816cdef6 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java +++ b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.utils; +import io.github.pixee.security.ZipSecurity; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -144,7 +145,7 @@ public class FileToPdf { private static Path unzipAndGetMainHtml(byte[] fileBytes) throws IOException { Path tempDirectory = Files.createTempDirectory("unzipped_"); - try (ZipInputStream zipIn = new ZipInputStream(new ByteArrayInputStream(fileBytes))) { + try (ZipInputStream zipIn = ZipSecurity.createHardenedInputStream(new ByteArrayInputStream(fileBytes))) { ZipEntry entry = zipIn.getNextEntry(); while (entry != null) { Path filePath = tempDirectory.resolve(entry.getName()); From d67690d99550c2a97f896693febe995d24aabbd5 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:43:25 +0000 Subject: [PATCH 45/90] Update build.gradle --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 694b7fd4..a473e733 100644 --- a/build.gradle +++ b/build.gradle @@ -91,6 +91,8 @@ dependencies { implementation 'ch.qos.logback:logback-core:1.4.14' implementation 'org.springframework:spring-webmvc:6.1.2' + implementation("io.github.pixee:java-security-toolkit:1.1.2") + implementation 'org.yaml:snakeyaml:2.2' implementation 'org.springframework.boot:spring-boot-starter-web:3.2.2' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.2.2' From 450e090252d911970f5c580a2b6ae4e71ce1fdd9 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Thu, 1 Feb 2024 23:01:04 +0000 Subject: [PATCH 46/90] Protect `readLine()` against DoS --- .../java/stirling/software/SPDF/utils/ProcessExecutor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java b/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java index 23311bde..f75367a7 100644 --- a/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java +++ b/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.utils; +import io.github.pixee.security.BoundedLineReader; import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -109,7 +110,7 @@ public class ProcessExecutor { process.getErrorStream(), StandardCharsets.UTF_8))) { String line; - while ((line = errorReader.readLine()) != null) { + while ((line = BoundedLineReader.readLine(errorReader, 5_000_000)) != null) { errorLines.add(line); if (liveUpdates) logger.info(line); } @@ -130,7 +131,7 @@ public class ProcessExecutor { process.getInputStream(), StandardCharsets.UTF_8))) { String line; - while ((line = outputReader.readLine()) != null) { + while ((line = BoundedLineReader.readLine(outputReader, 5_000_000)) != null) { outputLines.add(line); if (liveUpdates) logger.info(line); } From 91caa2a097f5784d7a501c9f40da8345841ca659 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Thu, 1 Feb 2024 23:18:24 +0000 Subject: [PATCH 47/90] Introduced protections against system command injection --- src/main/java/stirling/software/SPDF/LibreOfficeListener.java | 3 ++- src/main/java/stirling/software/SPDF/SPdfApplication.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/LibreOfficeListener.java b/src/main/java/stirling/software/SPDF/LibreOfficeListener.java index 6d32adc3..d8196dcd 100644 --- a/src/main/java/stirling/software/SPDF/LibreOfficeListener.java +++ b/src/main/java/stirling/software/SPDF/LibreOfficeListener.java @@ -1,5 +1,6 @@ package stirling.software.SPDF; +import io.github.pixee.security.SystemCommand; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; @@ -44,7 +45,7 @@ public class LibreOfficeListener { } // Start the listener process - process = Runtime.getRuntime().exec("unoconv --listener"); + process = SystemCommand.runCommand(Runtime.getRuntime(), "unoconv --listener"); lastActivityTime = System.currentTimeMillis(); // Start a background thread to monitor the activity timeout diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index 7388b5e4..8cdcc701 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -1,5 +1,6 @@ package stirling.software.SPDF; +import io.github.pixee.security.SystemCommand; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; @@ -34,7 +35,7 @@ public class SPdfApplication { Runtime rt = Runtime.getRuntime(); if (os.contains("win")) { // For Windows - rt.exec("rundll32 url.dll,FileProtocolHandler " + url); + SystemCommand.runCommand(rt, "rundll32 url.dll,FileProtocolHandler " + url); } } catch (Exception e) { e.printStackTrace(); From 8e0c02a1512c53395e6efbe7f39484315bc87432 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Thu, 1 Feb 2024 23:35:05 +0000 Subject: [PATCH 48/90] Sandboxed URL creation to prevent SSRF attacks --- src/main/java/stirling/software/SPDF/utils/GeneralUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java index 672e5c70..1b0c315a 100644 --- a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java @@ -1,5 +1,7 @@ package stirling.software.SPDF.utils; +import io.github.pixee.security.HostValidator; +import io.github.pixee.security.Urls; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -57,7 +59,7 @@ public class GeneralUtils { public static boolean isValidURL(String urlStr) { try { - new URL(urlStr); + Urls.create(urlStr, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS); return true; } catch (MalformedURLException e) { return false; From c8dfe10a7c7cdc4a361565c8c566b7cf0159eae0 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Thu, 1 Feb 2024 23:48:27 +0000 Subject: [PATCH 49/90] Sanitized user-provided file names in HTTP multipart uploads --- .../SPDF/controller/api/MultiPageLayoutController.java | 3 ++- .../software/SPDF/controller/api/PdfOverlayController.java | 3 ++- .../SPDF/controller/api/RearrangePagesPDFController.java | 5 +++-- .../software/SPDF/controller/api/RotationController.java | 3 ++- .../software/SPDF/controller/api/ScalePagesController.java | 3 ++- .../software/SPDF/controller/api/SplitPDFController.java | 3 ++- .../SPDF/controller/api/SplitPdfBySectionsController.java | 3 ++- .../SPDF/controller/api/SplitPdfBySizeController.java | 3 ++- .../api/converters/ConvertBookToPDFController.java | 3 ++- .../SPDF/controller/api/converters/ConvertHtmlToPDF.java | 3 ++- .../controller/api/converters/ConvertImgPDFController.java | 3 ++- .../controller/api/converters/ConvertMarkdownToPdf.java | 3 ++- .../controller/api/converters/ConvertOfficeController.java | 5 +++-- .../api/converters/ConvertPDFToBookController.java | 3 ++- .../SPDF/controller/api/converters/ConvertPDFToPDFA.java | 3 ++- .../SPDF/controller/api/filters/FilterController.java | 5 +++-- .../SPDF/controller/api/misc/AutoRenameController.java | 3 ++- .../SPDF/controller/api/misc/AutoSplitPdfController.java | 3 ++- .../SPDF/controller/api/misc/BlankPageController.java | 3 ++- .../SPDF/controller/api/misc/CompressController.java | 3 ++- .../SPDF/controller/api/misc/ExtractImagesController.java | 3 ++- .../SPDF/controller/api/misc/FakeScanControllerWIP.java | 3 ++- .../SPDF/controller/api/misc/MetadataController.java | 3 ++- .../software/SPDF/controller/api/misc/OCRController.java | 5 +++-- .../SPDF/controller/api/misc/OverlayImageController.java | 3 ++- .../SPDF/controller/api/misc/PageNumbersController.java | 5 +++-- .../SPDF/controller/api/misc/RepairController.java | 3 ++- .../software/SPDF/controller/api/misc/ShowJavascript.java | 3 ++- .../software/SPDF/controller/api/misc/StampController.java | 3 ++- .../SPDF/controller/api/pipeline/PipelineProcessor.java | 3 ++- .../SPDF/controller/api/security/CertSignController.java | 3 ++- .../SPDF/controller/api/security/PasswordController.java | 7 ++++--- .../SPDF/controller/api/security/RedactController.java | 3 ++- .../SPDF/controller/api/security/SanitizeController.java | 3 ++- .../SPDF/controller/api/security/WatermarkController.java | 3 ++- src/main/java/stirling/software/SPDF/utils/PDFToFile.java | 3 ++- src/main/java/stirling/software/SPDF/utils/PdfUtils.java | 3 ++- .../stirling/software/SPDF/utils/WebResponseUtils.java | 3 ++- 38 files changed, 83 insertions(+), 45 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java index ee6c2789..b4949a58 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.awt.Color; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -136,6 +137,6 @@ public class MultiPageLayoutController { byte[] result = baos.toByteArray(); return WebResponseUtils.bytesToWebResponse( result, - file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_layoutChanged.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_layoutChanged.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java index 05cf1263..ab96d01e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -75,7 +76,7 @@ public class PdfOverlayController { overlay.overlay(overlayGuide).save(outputStream); byte[] data = outputStream.toByteArray(); String outputFilename = - baseFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(baseFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_overlayed.pdf"; // Remove file extension and append .pdf return WebResponseUtils.bytesToWebResponse( diff --git a/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java index 1737d543..3074f9f8 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -57,7 +58,7 @@ public class RearrangePagesPDFController { } return WebResponseUtils.pdfDocToWebResponse( document, - pdfFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_removed_pages.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_removed_pages.pdf"); } private List removeFirst(int totalPages) { @@ -211,7 +212,7 @@ public class RearrangePagesPDFController { return WebResponseUtils.pdfDocToWebResponse( document, - pdfFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_rearranged.pdf"); } catch (IOException e) { logger.error("Failed rearranging documents", e); diff --git a/src/main/java/stirling/software/SPDF/controller/api/RotationController.java b/src/main/java/stirling/software/SPDF/controller/api/RotationController.java index 6f8613f8..609e20f8 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RotationController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RotationController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -49,6 +50,6 @@ public class RotationController { return WebResponseUtils.pdfDocToWebResponse( document, - pdfFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_rotated.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_rotated.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java index da55bad5..03994321 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; @@ -112,6 +113,6 @@ public class ScalePagesController { return WebResponseUtils.bytesToWebResponse( baos.toByteArray(), - file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_scaled.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_scaled.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java index 3dbb9335..c218788a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -83,7 +84,7 @@ public class SplitPDFController { Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = file.getOriginalFilename().replaceFirst("[.][^.]+$", ""); + String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { // loop through the split documents and write them to the zip file for (int i = 0; i < splitDocumentsBoas.size(); i++) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java index 90418169..2951a73e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -64,7 +65,7 @@ public class SplitPdfBySectionsController { sourceDocument.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = file.getOriginalFilename().replaceFirst("[.][^.]+$", ""); + String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java index 4bfde843..eb2cfa28 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -120,7 +121,7 @@ public class SplitPdfBySizeController { sourceDocument.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = file.getOriginalFilename().replaceFirst("[.][^.]+$", ""); + String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java index 453f8e6e..a266e871 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.converters; +import io.github.pixee.security.Filenames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.ResponseEntity; @@ -43,7 +44,7 @@ public class ConvertBookToPDFController { throw new IllegalArgumentException("Please provide a file for conversion."); } - String originalFilename = fileInput.getOriginalFilename(); + String originalFilename = Filenames.toSimpleFileName(fileInput.getOriginalFilename()); if (originalFilename != null) { String originalFilenameLower = originalFilename.toLowerCase(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java index 9e1d4fb9..2cf79992 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.converters; +import io.github.pixee.security.Filenames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.ResponseEntity; @@ -39,7 +40,7 @@ public class ConvertHtmlToPDF { "Please provide an HTML or ZIP file for conversion."); } - String originalFilename = fileInput.getOriginalFilename(); + String originalFilename = Filenames.toSimpleFileName(fileInput.getOriginalFilename()); if (originalFilename == null || (!originalFilename.endsWith(".html") && !originalFilename.endsWith(".zip"))) { throw new IllegalArgumentException("File must be either .html or .zip format."); diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java index a4f8a98d..548e4937 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.converters; +import io.github.pixee.security.Filenames; import java.io.IOException; import java.net.URLConnection; @@ -56,7 +57,7 @@ public class ConvertImgPDFController { // returns bytes for image boolean singleImage = singleOrMultiple.equals("single"); byte[] result = null; - String filename = file.getOriginalFilename().replaceFirst("[.][^.]+$", ""); + String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); try { result = PdfUtils.convertFromPdf( diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java index 12fc9097..39710ea0 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.converters; +import io.github.pixee.security.Filenames; import java.util.List; import java.util.Map; @@ -48,7 +49,7 @@ public class ConvertMarkdownToPdf { throw new IllegalArgumentException("Please provide a Markdown file for conversion."); } - String originalFilename = fileInput.getOriginalFilename(); + String originalFilename = Filenames.toSimpleFileName(fileInput.getOriginalFilename()); if (originalFilename == null || !originalFilename.endsWith(".md")) { throw new IllegalArgumentException("File must be in .md format."); } diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java index ebc9f4f5..ce3d9fe9 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.converters; +import io.github.pixee.security.Filenames; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -31,7 +32,7 @@ public class ConvertOfficeController { public byte[] convertToPdf(MultipartFile inputFile) throws IOException, InterruptedException { // Check for valid file extension - String originalFilename = inputFile.getOriginalFilename(); + String originalFilename = Filenames.toSimpleFileName(inputFile.getOriginalFilename()); if (originalFilename == null || !isValidFileExtension(FilenameUtils.getExtension(originalFilename))) { throw new IllegalArgumentException("Invalid file extension"); @@ -89,7 +90,7 @@ public class ConvertOfficeController { byte[] pdfByteArray = convertToPdf(inputFile); return WebResponseUtils.bytesToWebResponse( pdfByteArray, - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_convertedToPDF.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java index 1ee09d9e..9711fc5e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.converters; +import io.github.pixee.security.Filenames; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -92,7 +93,7 @@ public class ConvertPDFToBookController { } String outputFilename = - fileInput.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "." + outputFormat; // Remove file extension and append .pdf diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java index ac8ce031..5de8ee9a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.converters; +import io.github.pixee.security.Filenames; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -63,7 +64,7 @@ public class ConvertPDFToPDFA { // Return the optimized PDF as a response String outputFilename = - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_PDFA.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_PDFA.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java b/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java index 370aa6d7..6326cf19 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.filters; +import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -43,7 +44,7 @@ public class FilterController { PDDocument pdfDocument = Loader.loadPDF(inputFile.getBytes()); if (PdfUtils.hasText(pdfDocument, pageNumber, text)) return WebResponseUtils.pdfDocToWebResponse( - pdfDocument, inputFile.getOriginalFilename()); + pdfDocument, Filenames.toSimpleFileName(inputFile.getOriginalFilename())); return null; } @@ -60,7 +61,7 @@ public class FilterController { PDDocument pdfDocument = Loader.loadPDF(inputFile.getBytes()); if (PdfUtils.hasImages(pdfDocument, pageNumber)) return WebResponseUtils.pdfDocToWebResponse( - pdfDocument, inputFile.getOriginalFilename()); + pdfDocument, Filenames.toSimpleFileName(inputFile.getOriginalFilename())); return null; } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java index 9a78e4d1..9000658c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.io.IOException; import java.util.ArrayList; import java.util.Comparator; @@ -133,7 +134,7 @@ public class AutoRenameController { return WebResponseUtils.pdfDocToWebResponse(document, header + ".pdf"); } else { logger.info("File has no good title to be found"); - return WebResponseUtils.pdfDocToWebResponse(document, file.getOriginalFilename()); + return WebResponseUtils.pdfDocToWebResponse(document, Filenames.toSimpleFileName(file.getOriginalFilename())); } } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java index 8b095358..da162d85 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; @@ -97,7 +98,7 @@ public class AutoSplitPdfController { document.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = file.getOriginalFilename().replaceFirst("[.][^.]+$", ""); + String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java index 21e5987b..34664a3b 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.awt.image.BufferedImage; import java.io.IOException; import java.nio.file.Files; @@ -131,7 +132,7 @@ public class BlankPageController { return WebResponseUtils.pdfDocToWebResponse( document, - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_blanksRemoved.pdf"); } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java index 2b8a1541..c1b4a996 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; @@ -264,7 +265,7 @@ public class CompressController { // Return the optimized PDF as a response String outputFilename = - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_Optimized.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_Optimized.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java index 2ebc8f6c..24e7262c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; @@ -66,7 +67,7 @@ public class ExtractImagesController { zos.setLevel(Deflater.BEST_COMPRESSION); int imageIndex = 1; - String filename = file.getOriginalFilename().replaceFirst("[.][^.]+$", ""); + String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); int pageNum = 0; Set processedImages = new HashSet<>(); // Iterate over each page diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java index cf719f56..8fb4af43 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; @@ -141,7 +142,7 @@ public class FakeScanControllerWIP { // Return the optimized PDF as a response String outputFilename = - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_scanned.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_scanned.pdf"; return WebResponseUtils.boasToWebResponse(baos, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java index a5eb95ca..97119404 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -164,6 +165,6 @@ public class MetadataController { document.setDocumentInformation(info); return WebResponseUtils.pdfDocToWebResponse( document, - pdfFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_metadata.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_metadata.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java index 21cf2b1c..685a6526 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -182,12 +183,12 @@ public class OCRController { // Return the OCR processed PDF as a response String outputFilename = - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_OCR.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_OCR.pdf"; if (sidecar != null && sidecar) { // Create a zip file containing both the PDF and the text file String outputZipFilename = - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_OCR.zip"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_OCR.zip"; Path tempZipFile = Files.createTempFile("output_", ".zip"); try (ZipOutputStream zipOut = diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java index caf2efaf..01da177d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.io.IOException; import org.slf4j.Logger; @@ -44,7 +45,7 @@ public class OverlayImageController { return WebResponseUtils.bytesToWebResponse( result, - pdfFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_overlayed.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_overlayed.pdf"); } catch (IOException e) { logger.error("Failed to add image to PDF", e); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java index 79f62c5a..cd99e9d0 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -93,7 +94,7 @@ public class PageNumbersController { .replace("{total}", String.valueOf(document.getNumberOfPages())) .replace( "{filename}", - file.getOriginalFilename() + Filenames.toSimpleFileName(file.getOriginalFilename()) .replaceFirst("[.][^.]+$", "")) : String.valueOf(pageNumber); @@ -145,7 +146,7 @@ public class PageNumbersController { return WebResponseUtils.bytesToWebResponse( baos.toByteArray(), - file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_numbersAdded.pdf", + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_numbersAdded.pdf", MediaType.APPLICATION_PDF); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java index 112985a3..caaaed5c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -65,7 +66,7 @@ public class RepairController { // Return the optimized PDF as a response String outputFilename = - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_repaired.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_repaired.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java index 47a13d0c..0903a6e1 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.nio.charset.StandardCharsets; import java.util.Map; @@ -54,7 +55,7 @@ public class ShowJavascript { script += "// File: " - + inputFile.getOriginalFilename() + + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + ", Script: " + name + "\n" diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 0dd4200c..83519094 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.misc; +import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; @@ -127,7 +128,7 @@ public class StampController { return WebResponseUtils.pdfDocToWebResponse( document, - pdfFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); } private void addTextStamp( diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java index d84ea3c5..4fbc2aa9 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.pipeline; +import io.github.pixee.security.Filenames; import io.github.pixee.security.ZipSecurity; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -334,7 +335,7 @@ public class PipelineProcessor { new ByteArrayResource(file.getBytes()) { @Override public String getFilename() { - return file.getOriginalFilename(); + return Filenames.toSimpleFileName(file.getOriginalFilename()); } }; outputFiles.add(fileResource); diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java index e7cccb44..658f68f3 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.security; +import io.github.pixee.security.Filenames; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -123,7 +124,7 @@ public class CertSignController { ByteArrayOutputStream baos = new ByteArrayOutputStream(); sign(pdf.getBytes(), baos, createSignature, name, location, reason); return WebResponseUtils.boasToWebResponse( - baos, pdf.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_signed.pdf"); + baos, Filenames.toSimpleFileName(pdf.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_signed.pdf"); } private static void sign( diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java index 8d7c8072..328b753c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.security; +import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -43,7 +44,7 @@ public class PasswordController { document.setAllSecurityToBeRemoved(true); return WebResponseUtils.pdfDocToWebResponse( document, - fileInput.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_password_removed.pdf"); } @@ -88,10 +89,10 @@ public class PasswordController { if ("".equals(ownerPassword) && "".equals(password)) return WebResponseUtils.pdfDocToWebResponse( document, - fileInput.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_permissions.pdf"); return WebResponseUtils.pdfDocToWebResponse( document, - fileInput.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_passworded.pdf"); + Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_passworded.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java b/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java index 3d4653c5..82ff54dd 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.security; +import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; @@ -104,7 +105,7 @@ public class RedactController { byte[] pdfContent = baos.toByteArray(); return WebResponseUtils.bytesToWebResponse( pdfContent, - file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_redacted.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_redacted.pdf"); } private void redactFoundText( diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java b/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java index 8c46e0cf..bbcfeeaa 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.security; +import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -76,7 +77,7 @@ public class SanitizeController { return WebResponseUtils.pdfDocToWebResponse( document, - inputFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_sanitized.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java index 6630a200..f1d984fa 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.controller.api.security; +import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; @@ -104,7 +105,7 @@ public class WatermarkController { return WebResponseUtils.pdfDocToWebResponse( document, - pdfFile.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); } private void addTextWatermark( diff --git a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java index a7f751af..e210d8a9 100644 --- a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java +++ b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.utils; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -32,7 +33,7 @@ public class PDFToFile { } // Get the original PDF file name without the extension - String originalPdfFileName = inputFile.getOriginalFilename(); + String originalPdfFileName = Filenames.toSimpleFileName(inputFile.getOriginalFilename()); String pdfBaseName = originalPdfFileName.substring(0, originalPdfFileName.lastIndexOf('.')); // Validate output format diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index 1676ce85..03e03671 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.utils; +import io.github.pixee.security.Filenames; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; @@ -299,7 +300,7 @@ public class PdfUtils { try (PDDocument doc = new PDDocument()) { for (MultipartFile file : files) { String contentType = file.getContentType(); - String originalFilename = file.getOriginalFilename(); + String originalFilename = Filenames.toSimpleFileName(file.getOriginalFilename()); if (originalFilename != null && (originalFilename.toLowerCase().endsWith(".tiff") || originalFilename.toLowerCase().endsWith(".tif"))) { diff --git a/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java b/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java index 1114de64..a85720e7 100644 --- a/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java @@ -1,5 +1,6 @@ package stirling.software.SPDF.utils; +import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URLEncoder; @@ -26,7 +27,7 @@ public class WebResponseUtils { public static ResponseEntity multiPartFileToWebResponse(MultipartFile file) throws IOException { - String fileName = file.getOriginalFilename(); + String fileName = Filenames.toSimpleFileName(file.getOriginalFilename()); MediaType mediaType = MediaType.parseMediaType(file.getContentType()); byte[] bytes = file.getBytes(); From 734fff5618c15ae0798363265eb611fe21b1d9de Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Fri, 2 Feb 2024 00:15:46 +0000 Subject: [PATCH 50/90] Modernize and secure temp file creation --- .../software/SPDF/controller/api/PdfOverlayController.java | 3 ++- .../software/SPDF/controller/api/misc/StampController.java | 3 ++- .../SPDF/controller/api/security/WatermarkController.java | 3 ++- src/main/java/stirling/software/SPDF/utils/GeneralUtils.java | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java index ab96d01e..f9938a39 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java @@ -4,6 +4,7 @@ import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -136,7 +137,7 @@ public class PdfOverlayController { try (PDDocument overlayPdf = Loader.loadPDF(overlayFiles[overlayFileIndex])) { PDDocument singlePageDocument = new PDDocument(); singlePageDocument.addPage(overlayPdf.getPage(pageCountInCurrentOverlay)); - File tempFile = File.createTempFile("overlay-page-", ".pdf"); + File tempFile = Files.createTempFile("overlay-page-", ".pdf").toFile(); singlePageDocument.save(tempFile); singlePageDocument.close(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 83519094..9a01cf4d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import javax.imageio.ImageIO; @@ -169,7 +170,7 @@ public class StampController { if (!resourceDir.equals("")) { ClassPathResource classPathResource = new ClassPathResource(resourceDir); String fileExtension = resourceDir.substring(resourceDir.lastIndexOf(".")); - File tempFile = File.createTempFile("NotoSansFont", fileExtension); + File tempFile = Files.createTempFile("NotoSansFont", fileExtension).toFile(); try (InputStream is = classPathResource.getInputStream(); FileOutputStream os = new FileOutputStream(tempFile)) { IOUtils.copy(is, os); diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java index f1d984fa..469f32be 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import javax.imageio.ImageIO; @@ -143,7 +144,7 @@ public class WatermarkController { if (!resourceDir.equals("")) { ClassPathResource classPathResource = new ClassPathResource(resourceDir); String fileExtension = resourceDir.substring(resourceDir.lastIndexOf(".")); - File tempFile = File.createTempFile("NotoSansFont", fileExtension); + File tempFile = Files.createTempFile("NotoSansFont", fileExtension).toFile(); try (InputStream is = classPathResource.getInputStream(); FileOutputStream os = new FileOutputStream(tempFile)) { IOUtils.copy(is, os); diff --git a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java index 1b0c315a..7b6905db 100644 --- a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java @@ -22,7 +22,7 @@ import org.springframework.web.multipart.MultipartFile; public class GeneralUtils { public static File convertMultipartFileToFile(MultipartFile multipartFile) throws IOException { - File tempFile = File.createTempFile("temp", null); + File tempFile = Files.createTempFile("temp", null).toFile(); try (FileOutputStream os = new FileOutputStream(tempFile)) { os.write(multipartFile.getBytes()); } From 95471a2fba891a55ff0205cfcd9c64546296f6e1 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Fri, 2 Feb 2024 00:29:18 +0000 Subject: [PATCH 51/90] Switch order of literals to prevent NullPointerException --- scripts/PropSync.java | 2 +- .../software/SPDF/SPdfApplication.java | 2 +- .../SPDF/config/ConfigInitializer.java | 2 +- .../converters/ConvertImgPDFController.java | 4 ++-- .../api/misc/ExtractImageScansController.java | 2 +- .../api/misc/ExtractImagesController.java | 6 +++--- .../api/misc/MetadataController.java | 18 +++++++++--------- .../controller/api/misc/OCRController.java | 4 ++-- .../controller/api/misc/StampController.java | 6 +++--- .../api/pipeline/PipelineProcessor.java | 2 +- .../api/security/WatermarkController.java | 6 +++--- .../SPDF/controller/web/MetricsController.java | 8 ++++---- .../software/SPDF/utils/FileToPdf.java | 2 +- .../software/SPDF/utils/GeneralUtils.java | 6 +++--- .../software/SPDF/utils/PDFToFile.java | 2 +- .../stirling/software/SPDF/utils/PdfUtils.java | 8 ++++---- 16 files changed, 40 insertions(+), 40 deletions(-) diff --git a/scripts/PropSync.java b/scripts/PropSync.java index 741712b5..41228b5b 100644 --- a/scripts/PropSync.java +++ b/scripts/PropSync.java @@ -16,7 +16,7 @@ public class PropSync { Map enProps = linesToProps(enLines); for (File file : files) { - if (!file.getName().equals("messages_en_GB.properties")) { + if (!"messages_en_GB.properties".equals(file.getName())) { System.out.println("Processing file: " + file.getName()); List lines; try { diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index 8cdcc701..f37dfb6e 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -25,7 +25,7 @@ public class SPdfApplication { public void init() { // Check if the BROWSER_OPEN environment variable is set to true String browserOpenEnv = env.getProperty("BROWSER_OPEN"); - boolean browserOpen = browserOpenEnv != null && browserOpenEnv.equalsIgnoreCase("true"); + boolean browserOpen = browserOpenEnv != null && "true".equalsIgnoreCase(browserOpenEnv); if (browserOpen) { try { diff --git a/src/main/java/stirling/software/SPDF/config/ConfigInitializer.java b/src/main/java/stirling/software/SPDF/config/ConfigInitializer.java index 6435c955..a5d05999 100644 --- a/src/main/java/stirling/software/SPDF/config/ConfigInitializer.java +++ b/src/main/java/stirling/software/SPDF/config/ConfigInitializer.java @@ -84,7 +84,7 @@ public class ConfigInitializer for (String line : templateLines) { String key = extractKey.apply(line); - if (line.trim().equalsIgnoreCase("AutomaticallyGenerated:")) { + if ("AutomaticallyGenerated:".equalsIgnoreCase(line.trim())) { insideAutoGenerated = true; mergedLines.add(line); continue; diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java index 548e4937..c131d883 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java @@ -55,7 +55,7 @@ public class ConvertImgPDFController { colorTypeResult = ImageType.BINARY; } // returns bytes for image - boolean singleImage = singleOrMultiple.equals("single"); + boolean singleImage = "single".equals(singleOrMultiple); byte[] result = null; String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); try { @@ -114,6 +114,6 @@ public class ConvertImgPDFController { private String getMediaType(String imageFormat) { String mimeType = URLConnection.guessContentTypeFromName("." + imageFormat); - return mimeType.equals("null") ? "application/octet-stream" : mimeType; + return "null".equals(mimeType) ? "application/octet-stream" : mimeType; } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java index 510607e8..da684280 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java @@ -74,7 +74,7 @@ public class ExtractImageScansController { List images = new ArrayList<>(); // Check if input file is a PDF - if (extension.equalsIgnoreCase("pdf")) { + if ("pdf".equalsIgnoreCase(extension)) { // Load PDF document try (PDDocument document = Loader.loadPDF(form.getFileInput().getBytes())) { PDFRenderer pdfRenderer = new PDFRenderer(document); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java index 24e7262c..cb9071d8 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java @@ -86,19 +86,19 @@ public class ExtractImagesController { // Convert image to desired format RenderedImage renderedImage = image.getImage(); BufferedImage bufferedImage = null; - if (format.equalsIgnoreCase("png")) { + if ("png".equalsIgnoreCase(format)) { bufferedImage = new BufferedImage( renderedImage.getWidth(), renderedImage.getHeight(), BufferedImage.TYPE_INT_ARGB); - } else if (format.equalsIgnoreCase("jpeg") || format.equalsIgnoreCase("jpg")) { + } else if ("jpeg".equalsIgnoreCase(format) || "jpg".equalsIgnoreCase(format)) { bufferedImage = new BufferedImage( renderedImage.getWidth(), renderedImage.getHeight(), BufferedImage.TYPE_INT_RGB); - } else if (format.equalsIgnoreCase("gif")) { + } else if ("gif".equalsIgnoreCase(format)) { bufferedImage = new BufferedImage( renderedImage.getWidth(), diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java index 97119404..8e4ae664 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java @@ -110,15 +110,15 @@ public class MetadataController { for (Entry entry : allRequestParams.entrySet()) { String key = entry.getKey(); // Check if the key is a standard metadata key - if (!key.equalsIgnoreCase("Author") - && !key.equalsIgnoreCase("CreationDate") - && !key.equalsIgnoreCase("Creator") - && !key.equalsIgnoreCase("Keywords") - && !key.equalsIgnoreCase("modificationDate") - && !key.equalsIgnoreCase("Producer") - && !key.equalsIgnoreCase("Subject") - && !key.equalsIgnoreCase("Title") - && !key.equalsIgnoreCase("Trapped") + if (!"Author".equalsIgnoreCase(key) + && !"CreationDate".equalsIgnoreCase(key) + && !"Creator".equalsIgnoreCase(key) + && !"Keywords".equalsIgnoreCase(key) + && !"modificationDate".equalsIgnoreCase(key) + && !"Producer".equalsIgnoreCase(key) + && !"Subject".equalsIgnoreCase(key) + && !"Title".equalsIgnoreCase(key) + && !"Trapped".equalsIgnoreCase(key) && !key.contains("customKey") && !key.contains("customValue")) { info.setCustomMetadataValue(key, entry.getValue()); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java index 685a6526..143ae1da 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java @@ -75,7 +75,7 @@ public class OCRController { throw new IOException("Please select at least one language."); } - if (!ocrRenderType.equals("hocr") && !ocrRenderType.equals("sandwich")) { + if (!"hocr".equals(ocrRenderType) && !"sandwich".equals(ocrRenderType)) { throw new IOException("ocrRenderType wrong"); } @@ -128,7 +128,7 @@ public class OCRController { if (cleanFinal != null && cleanFinal) { command.add("--clean-final"); } - if (ocrType != null && !ocrType.equals("")) { + if (ocrType != null && !"".equals(ocrType)) { if ("skip-text".equals(ocrType)) { command.add("--skip-text"); } else if ("force-ocr".equals(ocrType)) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 9a01cf4d..52e8d970 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -96,7 +96,7 @@ public class StampController { graphicsState.setNonStrokingAlphaConstant(opacity); contentStream.setGraphicsStateParameters(graphicsState); - if (watermarkType.equalsIgnoreCase("text")) { + if ("text".equalsIgnoreCase(watermarkType)) { addTextStamp( contentStream, watermarkText, @@ -110,7 +110,7 @@ public class StampController { overrideY, marginFactor, customColor); - } else if (watermarkType.equalsIgnoreCase("image")) { + } else if ("image".equalsIgnoreCase(watermarkType)) { addImageStamp( contentStream, watermarkImage, @@ -167,7 +167,7 @@ public class StampController { break; } - if (!resourceDir.equals("")) { + if (!"".equals(resourceDir)) { ClassPathResource classPathResource = new ClassPathResource(resourceDir); String fileExtension = resourceDir.substring(resourceDir.lastIndexOf(".")); File tempFile = Files.createTempFile("NotoSansFont", fileExtension).toFile(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java index 4fbc2aa9..c4e98bdb 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java @@ -98,7 +98,7 @@ public class PipelineProcessor { for (Resource file : outputFiles) { boolean hasInputFileType = false; for (String extension : inputFileTypes) { - if (extension.equals("ALL") || file.getFilename().endsWith(extension)) { + if ("ALL".equals(extension) || file.getFilename().endsWith(extension)) { hasInputFileType = true; MultiValueMap body = new LinkedMultiValueMap<>(); body.add("fileInput", file); diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java index 469f32be..91a8a265 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java @@ -77,7 +77,7 @@ public class WatermarkController { graphicsState.setNonStrokingAlphaConstant(opacity); contentStream.setGraphicsStateParameters(graphicsState); - if (watermarkType.equalsIgnoreCase("text")) { + if ("text".equalsIgnoreCase(watermarkType)) { addTextWatermark( contentStream, watermarkText, @@ -88,7 +88,7 @@ public class WatermarkController { heightSpacer, fontSize, alphabet); - } else if (watermarkType.equalsIgnoreCase("image")) { + } else if ("image".equalsIgnoreCase(watermarkType)) { addImageWatermark( contentStream, watermarkImage, @@ -141,7 +141,7 @@ public class WatermarkController { break; } - if (!resourceDir.equals("")) { + if (!"".equals(resourceDir)) { ClassPathResource classPathResource = new ClassPathResource(resourceDir); String fileExtension = resourceDir.substring(resourceDir.lastIndexOf(".")); File tempFile = Files.createTempFile("NotoSansFont", fileExtension).toFile(); diff --git a/src/main/java/stirling/software/SPDF/controller/web/MetricsController.java b/src/main/java/stirling/software/SPDF/controller/web/MetricsController.java index 5b079042..155fcdbd 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/MetricsController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/MetricsController.java @@ -84,7 +84,7 @@ public class MetricsController { for (Meter meter : meterRegistry.getMeters()) { if (meter.getId().getName().equals("http.requests")) { String method = meter.getId().getTag("method"); - if (method != null && method.equals("GET")) { + if (method != null && "GET".equals(method)) { if (endpoint.isPresent() && !endpoint.get().isBlank()) { if (!endpoint.get().startsWith("/")) { @@ -129,7 +129,7 @@ public class MetricsController { for (Meter meter : meterRegistry.getMeters()) { if (meter.getId().getName().equals("http.requests")) { String method = meter.getId().getTag("method"); - if (method != null && method.equals("GET")) { + if (method != null && "GET".equals(method)) { String uri = meter.getId().getTag("uri"); if (uri != null) { double currentCount = counts.getOrDefault(uri, 0.0); @@ -197,7 +197,7 @@ public class MetricsController { for (Meter meter : meterRegistry.getMeters()) { if (meter.getId().getName().equals("http.requests")) { String method = meter.getId().getTag("method"); - if (method != null && method.equals("POST")) { + if (method != null && "POST".equals(method)) { if (endpoint.isPresent() && !endpoint.get().isBlank()) { if (!endpoint.get().startsWith("/")) { endpoint = Optional.of("/" + endpoint.get()); @@ -235,7 +235,7 @@ public class MetricsController { for (Meter meter : meterRegistry.getMeters()) { if (meter.getId().getName().equals("http.requests")) { String method = meter.getId().getTag("method"); - if (method != null && method.equals("POST")) { + if (method != null && "POST".equals(method)) { String uri = meter.getId().getTag("uri"); if (uri != null) { double currentCount = counts.getOrDefault(uri, 0.0); diff --git a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java index 816cdef6..09ce430c 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java +++ b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java @@ -173,7 +173,7 @@ public class FileToPdf { // Prioritize 'index.html' if it exists, otherwise use the first .html file for (Path htmlFile : htmlFiles) { - if (htmlFile.getFileName().toString().equals("index.html")) { + if ("index.html".equals(htmlFile.getFileName().toString())) { return htmlFile; } } diff --git a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java index 7b6905db..1737b27e 100644 --- a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java @@ -122,7 +122,7 @@ public class GeneralUtils { // loop through the page order array for (String element : pageOrderArr) { - if (element.equalsIgnoreCase("all")) { + if ("all".equalsIgnoreCase(element)) { for (int i = 0; i < totalPages; i++) { newPageOrder.add(i); } @@ -137,11 +137,11 @@ public class GeneralUtils { if (element.contains("n")) { String[] parts = element.split("n"); - if (!parts[0].equals("") && parts[0] != null) { + if (!"".equals(parts[0]) && parts[0] != null) { coefficient = Integer.parseInt(parts[0]); coefficientExists = true; } - if (parts.length > 1 && !parts[1].equals("") && parts[1] != null) { + if (parts.length > 1 && !"".equals(parts[1]) && parts[1] != null) { constant = Integer.parseInt(parts[1]); constantExists = true; } diff --git a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java index e210d8a9..7afe6a49 100644 --- a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java +++ b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java @@ -88,7 +88,7 @@ public class PDFToFile { if (outputFiles.size() == 1) { // Return single output file File outputFile = outputFiles.get(0); - if (outputFormat.equals("txt:Text")) { + if ("txt:Text".equals(outputFormat)) { outputFormat = "txt"; } fileName = pdfBaseName + "." + outputFormat; diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index 03e03671..748f8aad 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -133,7 +133,7 @@ public class PdfUtils { PDFTextStripper textStripper = new PDFTextStripper(); String pdfText = ""; - if (pagesToCheck == null || pagesToCheck.equals("all")) { + if (pagesToCheck == null || "all".equals(pagesToCheck)) { pdfText = textStripper.getText(pdfDocument); } else { // remove whitespaces @@ -219,8 +219,8 @@ public class PdfUtils { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (singleImage) { - if (imageType.toLowerCase().equals("tiff") - || imageType.toLowerCase().equals("tif")) { + if ("tiff".equals(imageType.toLowerCase()) + || "tif".equals(imageType.toLowerCase())) { // Write the images to the output stream as a TIFF with multiple frames ImageWriter writer = ImageIO.getImageWritersByFormatName("tiff").next(); ImageWriteParam param = writer.getDefaultWriteParam(); @@ -321,7 +321,7 @@ public class PdfUtils { ImageProcessingUtils.convertColorType(image, colorType); // Use JPEGFactory if it's JPEG since JPEG is lossy PDImageXObject pdImage = - (contentType != null && contentType.equals("image/jpeg")) + (contentType != null && "image/jpeg".equals(contentType)) ? JPEGFactory.createFromImage(doc, convertedImage) : LosslessFactory.createFromImage(doc, convertedImage); addImageToDocument(doc, pdImage, fitOption, autoRotate); From 48be77270385d18d3f9fd33e4ed190c7fceef2bd Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 3 Feb 2024 22:54:33 +0000 Subject: [PATCH 52/90] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a473e733..7025b2bd 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ plugins { import com.github.jk1.license.render.* group = 'stirling.software' -version = '0.20.1' +version = '0.20.2' sourceCompatibility = '17' repositories { From 96f4e5eac72763cd5d7442b7a0fdb6ebb85754dd Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Sun, 4 Feb 2024 18:08:55 +0100 Subject: [PATCH 53/90] fix: small corrections for Dutch language --- src/main/resources/messages_nl_NL.properties | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/resources/messages_nl_NL.properties b/src/main/resources/messages_nl_NL.properties index c56e988a..a9e0ba91 100644 --- a/src/main/resources/messages_nl_NL.properties +++ b/src/main/resources/messages_nl_NL.properties @@ -5,8 +5,8 @@ language.direction=ltr pdfPrompt=Selecteer PDF('s) -multiPdfPrompt=Selecteer PDFs (2+) -multiPdfDropPrompt=Selecteer (of sleep & zet neer) alle PDFs die je nodig hebt +multiPdfPrompt=Selecteer PDF's (2+) +multiPdfDropPrompt=Selecteer (of sleep & zet neer) alle PDF's die je nodig hebt imgPrompt=Selecteer afbeelding(en) genericSubmit=Indienen processTimeWarning=Waarschuwing: Dit proces kan tot een minuut duren afhankelijk van de bestandsgrootte @@ -65,7 +65,7 @@ pipeline.submitButton=Opslaan ###################### # Pipeline Options # ###################### -pipelineOptions.header=Pijplijn onfiguratie +pipelineOptions.header=Pijplijn configuratie pipelineOptions.pipelineNameLabel=Pijplijn naam pipelineOptions.saveSettings=Instellingen voor bewerking opslaan pipelineOptions.pipelineNamePrompt=Voer hier de naam van de pijplijn in @@ -217,7 +217,7 @@ home.removePassword.desc=Verwijder wachtwoordbeveiliging van je PDF-document. removePassword.tags=veilig,Decrypteren,beveiliging,wachtwoord verwijderen home.compressPdfs.title=Comprimeren -home.compressPdfs.desc=Comprimeer PDFs om hun bestandsgrootte te verkleinen. +home.compressPdfs.desc=Comprimeer PDF's om hun bestandsgrootte te verkleinen. compressPdfs.tags=comprimeren,klein @@ -466,7 +466,7 @@ HTMLToPDF.header=HTML naar PDF HTMLToPDF.help=Accepteert HTML-bestanden en ZIP's die html/css/afbeeldingen etc. bevatten HTMLToPDF.submit=Converteren HTMLToPDF.credit=Gebruikt WeasyPrint -HTMLToPDF.zoom=Zoom level for displaying the website. +HTMLToPDF.zoom=Zoomniveau voor weergave van de website. HTMLToPDF.pageWidth=Breedte van de pagina in centimeters. (leeg voor standaard) HTMLToPDF.pageHeight=Hoogte van de pagina in centimeters. (leeg voor standaard) HTMLToPDF.marginTop=Marge bovenaan de pagina in millimeters. (leeg voor standaard) @@ -494,7 +494,7 @@ AddStampRequest.opacity=Transparantie AddStampRequest.position=Positie AddStampRequest.overrideX=X coördinaat overschrijven AddStampRequest.overrideY=Y coördinaat overschrijven -AddStampRequest.customMargin=Aangepate marge +AddStampRequest.customMargin=Aangepaste marge AddStampRequest.customColor=Aangepaste tekstkleur AddStampRequest.submit=Indienen @@ -584,11 +584,11 @@ scalePages.submit=Indienen certSign.title=Certificaat ondertekening certSign.header=Onderteken een PDF met je certificaat (in ontwikkeling) certSign.selectPDF=Selecteer een PDF-bestand voor ondertekening: -certSign.jksNote=Note: If your certificate type is not listed below, please convert it to a Java Keystore (.jks) file using the keytool command line tool. Then, choose the .jks file option below. +certSign.jksNote=Let op: als het certificaattype hieronder niet staat, converteer het dan naar een Java Keystore (.jks) bestand met de keytool command line tool. Kies vervolgens de .jks bestandsoptie. certSign.selectKey=Selecteer je privésleutelbestand (PKCS#8 formaat, kan .pem of .der zijn): certSign.selectCert=Selecteer je certificaatbestand (X.509 formaat, kan .pem of .der zijn): certSign.selectP12=Selecteer je PKCS#12 Sleutelopslagbestand (.p12 of .pfx) (Optioneel, indien verstrekt, moet het je privésleutel en certificaat bevatten): -certSign.selectJKS=Select Your Java Keystore File (.jks or .keystore): +certSign.selectJKS=Selecteer je Java Keystore bestand (.jks of .keystore): certSign.certType=Certificaattype certSign.password=Voer je sleutelopslag of privésleutel wachtwoord in (indien van toepassing): certSign.showSig=Toon handtekening @@ -920,8 +920,8 @@ PDFToXML.submit=Converteren #PDFToCSV PDFToCSV.title=PDF naar CSV PDFToCSV.header=PDF naar CSV -PDFToCSV.prompt=Choose page to extract table -PDFToCSV.submit=Extract +PDFToCSV.prompt=Kies pagina om tabel te extraheren +PDFToCSV.submit=Extraheren #split-by-size-or-count split-by-size-or-count.header=PDF splitsen op grootte of aantal @@ -961,11 +961,11 @@ split-by-sections.submit=PDF splitsen #licenses -licenses.nav=Licensies -licenses.title=Licensies van derden -licenses.header=Licensies van derden +licenses.nav=Licenties +licenses.title=Licenties van derden +licenses.header=Licenties van derden licenses.module=Module licenses.version=Versie -licenses.license=Licensie +licenses.license=Licentie From 734d76a3b5557fc6ffa90121e51e290239cb5d57 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Tue, 6 Feb 2024 00:00:49 +0000 Subject: [PATCH 54/90] test --- .../software/SPDF/LibreOfficeListener.java | 3 +- .../software/SPDF/SPdfApplication.java | 3 +- .../api/MultiPageLayoutController.java | 5 +- .../controller/api/PdfOverlayController.java | 5 +- .../api/RearrangePagesPDFController.java | 9 +- .../controller/api/RotationController.java | 6 +- .../controller/api/ScalePagesController.java | 5 +- .../controller/api/SplitPDFController.java | 6 +- .../api/SplitPdfBySectionsController.java | 6 +- .../api/SplitPdfBySizeController.java | 6 +- .../ConvertBookToPDFController.java | 2 +- .../api/converters/ConvertHtmlToPDF.java | 2 +- .../converters/ConvertImgPDFController.java | 6 +- .../api/converters/ConvertMarkdownToPdf.java | 2 +- .../converters/ConvertOfficeController.java | 5 +- .../ConvertPDFToBookController.java | 5 +- .../api/converters/ConvertPDFToPDFA.java | 6 +- .../api/filters/FilterController.java | 2 +- .../api/misc/AutoRenameController.java | 5 +- .../api/misc/AutoSplitPdfController.java | 6 +- .../api/misc/BlankPageController.java | 101 +++++++++--------- .../api/misc/CompressController.java | 6 +- .../api/misc/ExtractImagesController.java | 6 +- .../api/misc/FakeScanControllerWIP.java | 6 +- .../api/misc/MetadataController.java | 6 +- .../controller/api/misc/OCRController.java | 10 +- .../api/misc/OverlayImageController.java | 6 +- .../api/misc/PageNumbersController.java | 5 +- .../controller/api/misc/RepairController.java | 6 +- .../controller/api/misc/ShowJavascript.java | 5 +- .../controller/api/misc/StampController.java | 85 ++++++++------- .../api/pipeline/PipelineProcessor.java | 5 +- .../api/security/CertSignController.java | 6 +- .../api/security/PasswordController.java | 12 ++- .../api/security/RedactController.java | 5 +- .../api/security/SanitizeController.java | 5 +- .../api/security/WatermarkController.java | 6 +- .../SPDF/model/api/misc/AddStampRequest.java | 4 +- .../software/SPDF/utils/FileToPdf.java | 6 +- .../software/SPDF/utils/GeneralUtils.java | 17 ++- .../software/SPDF/utils/PDFToFile.java | 3 +- .../software/SPDF/utils/PdfUtils.java | 3 +- .../software/SPDF/utils/ProcessExecutor.java | 13 ++- .../software/SPDF/utils/WebResponseUtils.java | 3 +- src/main/resources/static/js/game.js | 19 +++- 45 files changed, 268 insertions(+), 176 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/LibreOfficeListener.java b/src/main/java/stirling/software/SPDF/LibreOfficeListener.java index d8196dcd..96c4d270 100644 --- a/src/main/java/stirling/software/SPDF/LibreOfficeListener.java +++ b/src/main/java/stirling/software/SPDF/LibreOfficeListener.java @@ -1,12 +1,13 @@ package stirling.software.SPDF; -import io.github.pixee.security.SystemCommand; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import io.github.pixee.security.SystemCommand; + public class LibreOfficeListener { private static final long ACTIVITY_TIMEOUT = 20 * 60 * 1000; // 20 minutes diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index f37dfb6e..62cbfe10 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -1,6 +1,5 @@ package stirling.software.SPDF; -import io.github.pixee.security.SystemCommand; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; @@ -11,6 +10,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.core.env.Environment; import org.springframework.scheduling.annotation.EnableScheduling; +import io.github.pixee.security.SystemCommand; + import jakarta.annotation.PostConstruct; import stirling.software.SPDF.config.ConfigInitializer; import stirling.software.SPDF.utils.GeneralUtils; diff --git a/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java index b4949a58..adc5424d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -137,6 +137,7 @@ public class MultiPageLayoutController { byte[] result = baos.toByteArray(); return WebResponseUtils.bytesToWebResponse( result, - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_layoutChanged.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_layoutChanged.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java index f9938a39..a6148d4a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -77,7 +77,8 @@ public class PdfOverlayController { overlay.overlay(overlayGuide).save(outputStream); byte[] data = outputStream.toByteArray(); String outputFilename = - Filenames.toSimpleFileName(baseFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(baseFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_overlayed.pdf"; // Remove file extension and append .pdf return WebResponseUtils.bytesToWebResponse( diff --git a/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java index 3074f9f8..88bdcd91 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -58,7 +58,9 @@ public class RearrangePagesPDFController { } return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_removed_pages.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_removed_pages.pdf"); } private List removeFirst(int totalPages) { @@ -212,7 +214,8 @@ public class RearrangePagesPDFController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_rearranged.pdf"); } catch (IOException e) { logger.error("Failed rearranging documents", e); diff --git a/src/main/java/stirling/software/SPDF/controller/api/RotationController.java b/src/main/java/stirling/software/SPDF/controller/api/RotationController.java index 609e20f8..76f508d3 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RotationController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RotationController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -50,6 +50,8 @@ public class RotationController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_rotated.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_rotated.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java index 03994321..91cd012d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; @@ -23,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -113,6 +113,7 @@ public class ScalePagesController { return WebResponseUtils.bytesToWebResponse( baos.toByteArray(), - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_scaled.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_scaled.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java index c218788a..44c87464 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -24,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -84,7 +84,9 @@ public class SplitPDFController { Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { // loop through the split documents and write them to the zip file for (int i = 0; i < splitDocumentsBoas.size(); i++) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java index 2951a73e..3deb798e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -27,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -65,7 +65,9 @@ public class SplitPdfBySectionsController { sourceDocument.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java index eb2cfa28..45d2dd38 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -121,7 +121,9 @@ public class SplitPdfBySizeController { sourceDocument.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java index a266e871..3cbc783c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.ResponseEntity; @@ -10,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java index 2cf79992..189eebdf 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.ResponseEntity; @@ -10,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java index c131d883..86a70472 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.net.URLConnection; @@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -57,7 +57,9 @@ public class ConvertImgPDFController { // returns bytes for image boolean singleImage = "single".equals(singleOrMultiple); byte[] result = null; - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); try { result = PdfUtils.convertFromPdf( diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java index 39710ea0..050dd0fe 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.util.List; import java.util.Map; @@ -20,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java index ce3d9fe9..c6740b5f 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -90,7 +90,8 @@ public class ConvertOfficeController { byte[] pdfByteArray = convertToPdf(inputFile); return WebResponseUtils.bytesToWebResponse( pdfByteArray, - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_convertedToPDF.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java index 9711fc5e..c9171305 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -93,7 +93,8 @@ public class ConvertPDFToBookController { } String outputFilename = - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "." + outputFormat; // Remove file extension and append .pdf diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java index 5de8ee9a..41498413 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -64,7 +64,9 @@ public class ConvertPDFToPDFA { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_PDFA.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_PDFA.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java b/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java index 6326cf19..9beaf413 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.filters; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -14,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java index 9000658c..2dc6c8a3 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.util.ArrayList; import java.util.Comparator; @@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -134,7 +134,8 @@ public class AutoRenameController { return WebResponseUtils.pdfDocToWebResponse(document, header + ".pdf"); } else { logger.info("File has no good title to be found"); - return WebResponseUtils.pdfDocToWebResponse(document, Filenames.toSimpleFileName(file.getOriginalFilename())); + return WebResponseUtils.pdfDocToWebResponse( + document, Filenames.toSimpleFileName(file.getOriginalFilename())); } } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java index da162d85..32f39c04 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; @@ -32,6 +31,7 @@ import com.google.zxing.PlanarYUVLuminanceSource; import com.google.zxing.Result; import com.google.zxing.common.HybridBinarizer; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -98,7 +98,9 @@ public class AutoSplitPdfController { document.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java index 34664a3b..a813ba79 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java @@ -1,25 +1,21 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.image.BufferedImage; import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; -import javax.imageio.ImageIO; - import org.apache.pdfbox.Loader; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDPageTree; import org.apache.pdfbox.rendering.PDFRenderer; import org.apache.pdfbox.text.PDFTextStripper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; @@ -28,12 +24,12 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.misc.RemoveBlankPagesRequest; import stirling.software.SPDF.utils.PdfUtils; -import stirling.software.SPDF.utils.ProcessExecutor; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -41,6 +37,8 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class BlankPageController { + private static final Logger logger = LoggerFactory.getLogger(BlankPageController.class); + @PostMapping(consumes = "multipart/form-data", value = "/remove-blanks") @Operation( summary = "Remove blank pages from a PDF file", @@ -63,63 +61,35 @@ public class BlankPageController { PDFRenderer pdfRenderer = new PDFRenderer(document); for (PDPage page : pages) { - System.out.println("checking page " + pageIndex); + logger.info("checking page " + pageIndex); textStripper.setStartPage(pageIndex + 1); textStripper.setEndPage(pageIndex + 1); String pageText = textStripper.getText(document); boolean hasText = !pageText.trim().isEmpty(); + + Boolean blank = false; if (hasText) { - pagesToKeepIndex.add(pageIndex); - System.out.println("page " + pageIndex + " has text"); + logger.info("page " + pageIndex + " has text, not blank"); + blank = false; } else { boolean hasImages = PdfUtils.hasImagesOnPage(page); if (hasImages) { - System.out.println("page " + pageIndex + " has image"); - - Path tempFile = Files.createTempFile("image_", ".png"); - + logger.info("page " + pageIndex + " has image, running blank detection"); // Render image and save as temp file - BufferedImage image = pdfRenderer.renderImageWithDPI(pageIndex, 300); - ImageIO.write(image, "png", tempFile.toFile()); - - List command = - new ArrayList<>( - Arrays.asList( - "python", - System.getProperty("user.dir") - + "/scripts/detect-blank-pages.py", - tempFile.toString(), - "--threshold", - String.valueOf(threshold), - "--white_percent", - String.valueOf(whitePercent))); - - Boolean blank = false; - // Run CLI command - try { - ProcessExecutor.getInstance(ProcessExecutor.Processes.PYTHON_OPENCV) - .runCommandWithOutputHandling(command); - } catch (IOException e) { - // From detect-blank-pages.py - // Return code 1: The image is considered blank. - // Return code 0: The image is not considered blank. - // Since the process returned with a failure code, it should be blank. - blank = true; - } - - if (blank) { - System.out.println("Skipping, Image was blank for page #" + pageIndex); - } else { - System.out.println( - "page " + pageIndex + " has image which is not blank"); - pagesToKeepIndex.add(pageIndex); - } + BufferedImage image = pdfRenderer.renderImageWithDPI(pageIndex, 30); + blank = isBlankImage(image, threshold, whitePercent, threshold); } } + + if (blank) { + logger.info("Skipping, Image was blank for page #" + pageIndex); + } else { + logger.info("page " + pageIndex + " has image which is not blank"); + pagesToKeepIndex.add(pageIndex); + } + pageIndex++; } - System.out.print("pagesToKeep=" + pagesToKeepIndex.size()); - // Remove pages not present in pagesToKeepIndex List pageIndices = IntStream.range(0, pages.getCount()).boxed().collect(Collectors.toList()); @@ -132,7 +102,8 @@ public class BlankPageController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_blanksRemoved.pdf"); } catch (IOException e) { e.printStackTrace(); @@ -141,4 +112,30 @@ public class BlankPageController { if (document != null) document.close(); } } + + public static boolean isBlankImage( + BufferedImage image, int threshold, double whitePercent, int blurSize) { + if (image == null) { + logger.info("Error: Image is null"); + return false; + } + + // Convert to binary image based on the threshold + int whitePixels = 0; + int totalPixels = image.getWidth() * image.getHeight(); + + for (int i = 0; i < image.getHeight(); i++) { + for (int j = 0; j < image.getWidth(); j++) { + int color = image.getRGB(j, i) & 0xFF; + if (color >= 255 - threshold) { + whitePixels++; + } + } + } + + double whitePixelPercentage = (whitePixels / (double) totalPixels) * 100; + logger.info(String.format("Page has white pixel percent of %.2f%%", whitePixelPercentage)); + + return whitePixelPercentage >= whitePercent; + } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java index c1b4a996..82a2c72f 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; @@ -30,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -265,7 +265,9 @@ public class CompressController { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_Optimized.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_Optimized.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java index cb9071d8..3931e2df 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; @@ -30,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -67,7 +67,9 @@ public class ExtractImagesController { zos.setLevel(Deflater.BEST_COMPRESSION); int imageIndex = 1; - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); int pageNum = 0; Set processedImages = new HashSet<>(); // Iterate over each page diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java index 8fb4af43..789bf17e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; @@ -34,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -142,7 +142,9 @@ public class FakeScanControllerWIP { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_scanned.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_scanned.pdf"; return WebResponseUtils.boasToWebResponse(baos, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java index 8e4ae664..fec07380 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -165,6 +165,8 @@ public class MetadataController { document.setDocumentInformation(info); return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_metadata.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_metadata.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java index 143ae1da..542e3c6d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -25,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -183,12 +183,16 @@ public class OCRController { // Return the OCR processed PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_OCR.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_OCR.pdf"; if (sidecar != null && sidecar) { // Create a zip file containing both the PDF and the text file String outputZipFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_OCR.zip"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_OCR.zip"; Path tempZipFile = Files.createTempFile("output_", ".zip"); try (ZipOutputStream zipOut = diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java index 01da177d..c3fad457 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.slf4j.Logger; @@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -45,7 +45,9 @@ public class OverlayImageController { return WebResponseUtils.bytesToWebResponse( result, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_overlayed.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_overlayed.pdf"); } catch (IOException e) { logger.error("Failed to add image to PDF", e); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java index cd99e9d0..337a9f48 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -146,7 +146,8 @@ public class PageNumbersController { return WebResponseUtils.bytesToWebResponse( baos.toByteArray(), - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_numbersAdded.pdf", + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_numbersAdded.pdf", MediaType.APPLICATION_PDF); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java index caaaed5c..85d4560c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -66,7 +66,9 @@ public class RepairController { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_repaired.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_repaired.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java index 0903a6e1..6accfb7a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.nio.charset.StandardCharsets; import java.util.Map; @@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -55,7 +55,8 @@ public class ShowJavascript { script += "// File: " - + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + + Filenames.toSimpleFileName( + inputFile.getOriginalFilename()) + ", Script: " + name + "\n" diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 52e8d970..4779b077 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; @@ -8,6 +7,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; +import java.util.List; import javax.imageio.ImageIO; @@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -52,6 +53,7 @@ public class StampController { public ResponseEntity addStamp(@ModelAttribute AddStampRequest request) throws IOException, Exception { MultipartFile pdfFile = request.getFileInput(); + List pageNumbers = request.getPageNumbersList(); String watermarkType = request.getStampType(); String watermarkText = request.getStampText(); MultipartFile watermarkImage = request.getStampImage(); @@ -87,49 +89,58 @@ public class StampController { // Load the input PDF PDDocument document = Loader.loadPDF(pdfFile.getBytes()); - for (PDPage page : document.getPages()) { - PDPageContentStream contentStream = - new PDPageContentStream( - document, page, PDPageContentStream.AppendMode.APPEND, true, true); + for (int pageIndex : pageNumbers) { + // Convert 1-based index to 0-based index required by + // document.getPages().get(index) + int zeroBasedIndex = pageIndex - 1; + // Check if the zeroBasedIndex is within the range of the document's pages + if (zeroBasedIndex >= 0 && zeroBasedIndex < document.getNumberOfPages()) { + PDPage page = document.getPage(zeroBasedIndex); + PDPageContentStream contentStream = + new PDPageContentStream( + document, page, PDPageContentStream.AppendMode.APPEND, true, true); - PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState(); - graphicsState.setNonStrokingAlphaConstant(opacity); - contentStream.setGraphicsStateParameters(graphicsState); + PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState(); + graphicsState.setNonStrokingAlphaConstant(opacity); + contentStream.setGraphicsStateParameters(graphicsState); - if ("text".equalsIgnoreCase(watermarkType)) { - addTextStamp( - contentStream, - watermarkText, - document, - page, - rotation, - position, - fontSize, - alphabet, - overrideX, - overrideY, - marginFactor, - customColor); - } else if ("image".equalsIgnoreCase(watermarkType)) { - addImageStamp( - contentStream, - watermarkImage, - document, - page, - rotation, - position, - fontSize, - overrideX, - overrideY, - marginFactor); + if ("text".equalsIgnoreCase(watermarkType)) { + addTextStamp( + contentStream, + watermarkText, + document, + page, + rotation, + position, + fontSize, + alphabet, + overrideX, + overrideY, + marginFactor, + customColor); + } else if ("image".equalsIgnoreCase(watermarkType)) { + addImageStamp( + contentStream, + watermarkImage, + document, + page, + rotation, + position, + fontSize, + overrideX, + overrideY, + marginFactor); + } + + contentStream.close(); } - - contentStream.close(); } return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_stamped.pdf"); } private void addTextStamp( diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java index c4e98bdb..c327cdd8 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java @@ -1,7 +1,5 @@ package stirling.software.SPDF.controller.api.pipeline; -import io.github.pixee.security.Filenames; -import io.github.pixee.security.ZipSecurity; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -38,6 +36,9 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; +import io.github.pixee.security.ZipSecurity; + import jakarta.servlet.ServletContext; import stirling.software.SPDF.SPdfApplication; import stirling.software.SPDF.model.PipelineConfig; diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java index 658f68f3..d066bd9a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -43,6 +42,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -124,7 +124,9 @@ public class CertSignController { ByteArrayOutputStream baos = new ByteArrayOutputStream(); sign(pdf.getBytes(), baos, createSignature, name, location, reason); return WebResponseUtils.boasToWebResponse( - baos, Filenames.toSimpleFileName(pdf.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_signed.pdf"); + baos, + Filenames.toSimpleFileName(pdf.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_signed.pdf"); } private static void sign( diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java index 328b753c..84c44933 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -44,7 +44,8 @@ public class PasswordController { document.setAllSecurityToBeRemoved(true); return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_password_removed.pdf"); } @@ -89,10 +90,13 @@ public class PasswordController { if ("".equals(ownerPassword) && "".equals(password)) return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_permissions.pdf"); return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_passworded.pdf"); + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_passworded.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java b/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java index 82ff54dd..0f482647 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; @@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -105,7 +105,8 @@ public class RedactController { byte[] pdfContent = baos.toByteArray(); return WebResponseUtils.bytesToWebResponse( pdfContent, - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_redacted.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_redacted.pdf"); } private void redactFoundText( diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java b/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java index bbcfeeaa..6dfbf044 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -29,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -77,7 +77,8 @@ public class SanitizeController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_sanitized.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java index 91a8a265..9506822c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; @@ -32,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -106,7 +106,9 @@ public class WatermarkController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_watermarked.pdf"); } private void addTextWatermark( diff --git a/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java b/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java index 82296acc..f4c449b0 100644 --- a/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java +++ b/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java @@ -6,11 +6,11 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; -import stirling.software.SPDF.model.api.PDFFile; +import stirling.software.SPDF.model.api.PDFWithPageNums; @Data @EqualsAndHashCode(callSuper = true) -public class AddStampRequest extends PDFFile { +public class AddStampRequest extends PDFWithPageNums { @Schema( description = "The stamp type (text or image)", diff --git a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java index 09ce430c..90f7dbc3 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java +++ b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.ZipSecurity; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -13,6 +12,8 @@ import java.util.stream.Stream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import io.github.pixee.security.ZipSecurity; + import stirling.software.SPDF.model.api.converters.HTMLToPdfRequest; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; @@ -145,7 +146,8 @@ public class FileToPdf { private static Path unzipAndGetMainHtml(byte[] fileBytes) throws IOException { Path tempDirectory = Files.createTempDirectory("unzipped_"); - try (ZipInputStream zipIn = ZipSecurity.createHardenedInputStream(new ByteArrayInputStream(fileBytes))) { + try (ZipInputStream zipIn = + ZipSecurity.createHardenedInputStream(new ByteArrayInputStream(fileBytes))) { ZipEntry entry = zipIn.getNextEntry(); while (entry != null) { Path filePath = tempDirectory.resolve(entry.getName()); diff --git a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java index 1737b27e..4ef5964c 100644 --- a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java @@ -1,13 +1,10 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.HostValidator; -import io.github.pixee.security.Urls; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; -import java.net.URL; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; @@ -15,10 +12,14 @@ import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.HostValidator; +import io.github.pixee.security.Urls; + public class GeneralUtils { public static File convertMultipartFileToFile(MultipartFile multipartFile) throws IOException { @@ -59,7 +60,8 @@ public class GeneralUtils { public static boolean isValidURL(String urlStr) { try { - Urls.create(urlStr, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS); + Urls.create( + urlStr, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS); return true; } catch (MalformedURLException e) { return false; @@ -114,6 +116,13 @@ public class GeneralUtils { } public static List parsePageString(String pageOrder, int totalPages) { + if (pageOrder == null || pageOrder.isEmpty()) { + return Collections.singletonList(1); + } + if (pageOrder.matches("\\d+")) { + // Convert the single number string to an integer and return it in a list + return Collections.singletonList(Integer.parseInt(pageOrder)); + } return parsePageList(pageOrder.split(","), totalPages); } diff --git a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java index 7afe6a49..43683be8 100644 --- a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java +++ b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -21,6 +20,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; + import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; public class PDFToFile { diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index 748f8aad..77814340 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.Filenames; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; @@ -38,6 +37,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; + public class PdfUtils { private static final Logger logger = LoggerFactory.getLogger(PdfUtils.class); diff --git a/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java b/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java index f75367a7..2c81dce5 100644 --- a/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java +++ b/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.BoundedLineReader; import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -17,6 +16,8 @@ import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import io.github.pixee.security.BoundedLineReader; + public class ProcessExecutor { private static final Logger logger = LoggerFactory.getLogger(ProcessExecutor.class); @@ -110,7 +111,10 @@ public class ProcessExecutor { process.getErrorStream(), StandardCharsets.UTF_8))) { String line; - while ((line = BoundedLineReader.readLine(errorReader, 5_000_000)) != null) { + while ((line = + BoundedLineReader.readLine( + errorReader, 5_000_000)) + != null) { errorLines.add(line); if (liveUpdates) logger.info(line); } @@ -131,7 +135,10 @@ public class ProcessExecutor { process.getInputStream(), StandardCharsets.UTF_8))) { String line; - while ((line = BoundedLineReader.readLine(outputReader, 5_000_000)) != null) { + while ((line = + BoundedLineReader.readLine( + outputReader, 5_000_000)) + != null) { outputLines.add(line); if (liveUpdates) logger.info(line); } diff --git a/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java b/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java index a85720e7..d148e65b 100644 --- a/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URLEncoder; @@ -13,6 +12,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; + public class WebResponseUtils { public static ResponseEntity boasToWebResponse( diff --git a/src/main/resources/static/js/game.js b/src/main/resources/static/js/game.js index ffad304b..9067cf97 100644 --- a/src/main/resources/static/js/game.js +++ b/src/main/resources/static/js/game.js @@ -14,13 +14,16 @@ function initializeGame() { const highScoreElement = document.getElementById('high-score'); let pdfSize = gameContainer.clientWidth * 0.0625; // 5% of container width - let projectileWidth = gameContainer.clientWidth * 0.00625; // 0.5% of container width + let projectileWidth = gameContainer.clientWidth * 0.00625;// 0.00625; // 0.5% of container width let projectileHeight = gameContainer.clientHeight * 0.01667; // 1% of container height let paused = false; + const fireRate = 200; // Time between shots in milliseconds let lastProjectileTime = 0; let lives = 3; + + let highScore = localStorage.getItem('highScore') ? parseInt(localStorage.getItem('highScore')) : 0; updateHighScore(); @@ -31,7 +34,7 @@ function initializeGame() { const projectiles = []; let score = 0; let level = 1; - let pdfSpeed = 1; + let pdfSpeed = 0.5; let gameOver = false; function handleKeys() { @@ -119,7 +122,7 @@ function initializeGame() { for (let pdfIndex = 0; pdfIndex < pdfs.length; pdfIndex++) { const pdf = pdfs[pdfIndex]; - const pdfY = parseInt(pdf.style.top) + pdfSpeed; + const pdfY = parseFloat(pdf.style.top) + pdfSpeed; if (pdfY + 50 > gameContainer.clientHeight) { gameContainer.removeChild(pdf); pdfs.splice(pdfIndex, 1); @@ -218,7 +221,7 @@ function initializeGame() { if (newLevel > level) { level = newLevel; levelElement.textContent = 'Level: ' + level; - pdfSpeed += 1; + pdfSpeed += 0.2; } } @@ -249,6 +252,10 @@ function initializeGame() { let spawnPdfTimeout; + const BASE_SPAWN_INTERVAL_MS = 1250; // milliseconds before a new enemy spawns + const LEVEL_INCREASE_FACTOR_MS = 0; // milliseconds to decrease the spawn interval per level + const MAX_SPAWN_RATE_REDUCTION_MS = 800; // Max milliseconds from the base spawn interval + function spawnPdfInterval() { console.log("spawnPdfInterval"); if (gameOver || paused) { @@ -258,7 +265,9 @@ function initializeGame() { } console.log("spawnPdfInterval 3"); spawnPdf(); - spawnPdfTimeout = setTimeout(spawnPdfInterval, 1000 - level * 50); + let spawnRateReduction = Math.min(level * LEVEL_INCREASE_FACTOR_MS, MAX_SPAWN_RATE_REDUCTION_MS); + let spawnRate = BASE_SPAWN_INTERVAL_MS - spawnRateReduction; + spawnPdfTimeout = setTimeout(spawnPdfInterval, spawnRate); } updatePlayerPosition(); From 296f265391c951b818c58ad053006adea83711c2 Mon Sep 17 00:00:00 2001 From: Stirling-PDF-Bot Date: Tue, 6 Feb 2024 08:39:13 +0000 Subject: [PATCH 55/90] Update 3rd Party Licenses --- .../resources/static/3rdPartyLicenses.json | 92 +++++++++++-------- 1 file changed, 53 insertions(+), 39 deletions(-) diff --git a/src/main/resources/static/3rdPartyLicenses.json b/src/main/resources/static/3rdPartyLicenses.json index 699be591..c03dd84c 100644 --- a/src/main/resources/static/3rdPartyLicenses.json +++ b/src/main/resources/static/3rdPartyLicenses.json @@ -95,6 +95,13 @@ "moduleLicense": "MPL 2.0", "moduleLicenseUrl": "https://www.mozilla.org/en-US/MPL/2.0/" }, + { + "moduleName": "com.martiansoftware:jsap", + "moduleUrl": "http://www.martiansoftware.com/jsap/", + "moduleVersion": "2.1", + "moduleLicense": "LGPL", + "moduleLicenseUrl": "http://www.martiansoftware.com/jsap/license.html" + }, { "moduleName": "com.opencsv:opencsv", "moduleUrl": "http://opencsv.sf.net", @@ -204,31 +211,38 @@ "moduleLicense": "The Apache Software License, Version 2.0", "moduleLicenseUrl": "/LICENSE.txt" }, + { + "moduleName": "io.github.pixee:java-security-toolkit", + "moduleUrl": "https://github.com/pixee/java-security-toolkit", + "moduleVersion": "1.1.2", + "moduleLicense": "MIT License", + "moduleLicenseUrl": "http://www.opensource.org/licenses/mit-license.php" + }, { "moduleName": "io.micrometer:micrometer-commons", "moduleUrl": "https://github.com/micrometer-metrics/micrometer", - "moduleVersion": "1.12.1", + "moduleVersion": "1.12.2", "moduleLicense": "The Apache Software License, Version 2.0", "moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "io.micrometer:micrometer-core", "moduleUrl": "https://github.com/micrometer-metrics/micrometer", - "moduleVersion": "1.12.1", + "moduleVersion": "1.12.2", "moduleLicense": "The Apache Software License, Version 2.0", "moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "io.micrometer:micrometer-jakarta9", "moduleUrl": "https://github.com/micrometer-metrics/micrometer", - "moduleVersion": "1.12.1", + "moduleVersion": "1.12.2", "moduleLicense": "The Apache Software License, Version 2.0", "moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "io.micrometer:micrometer-observation", "moduleUrl": "https://github.com/micrometer-metrics/micrometer", - "moduleVersion": "1.12.1", + "moduleVersion": "1.12.2", "moduleLicense": "The Apache Software License, Version 2.0", "moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt" }, @@ -310,7 +324,7 @@ }, { "moduleName": "net.bytebuddy:byte-buddy", - "moduleVersion": "1.14.10", + "moduleVersion": "1.14.11", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0.txt" }, @@ -385,21 +399,21 @@ { "moduleName": "org.apache.tomcat.embed:tomcat-embed-core", "moduleUrl": "https://tomcat.apache.org/", - "moduleVersion": "10.1.17", + "moduleVersion": "10.1.18", "moduleLicense": "Eclipse Public License - v 2.0", "moduleLicenseUrl": "https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt" }, { "moduleName": "org.apache.tomcat.embed:tomcat-embed-el", "moduleUrl": "https://tomcat.apache.org/", - "moduleVersion": "10.1.17", + "moduleVersion": "10.1.18", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt" }, { "moduleName": "org.apache.tomcat.embed:tomcat-embed-websocket", "moduleUrl": "https://tomcat.apache.org/", - "moduleVersion": "10.1.17", + "moduleVersion": "10.1.18", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.txt" }, @@ -582,14 +596,14 @@ { "moduleName": "org.slf4j:jul-to-slf4j", "moduleUrl": "http://www.slf4j.org", - "moduleVersion": "2.0.9", + "moduleVersion": "2.0.11", "moduleLicense": "MIT License", "moduleLicenseUrl": "http://www.opensource.org/licenses/mit-license.php" }, { "moduleName": "org.slf4j:slf4j-api", "moduleUrl": "http://www.slf4j.org", - "moduleVersion": "2.0.9", + "moduleVersion": "2.0.11", "moduleLicense": "MIT License", "moduleLicenseUrl": "http://www.opensource.org/licenses/mit-license.php" }, @@ -614,126 +628,126 @@ { "moduleName": "org.springframework.boot:spring-boot", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-actuator", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-actuator-autoconfigure", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-autoconfigure", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-devtools", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-actuator", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-aop", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-data-jpa", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-jdbc", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-json", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-logging", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-security", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-thymeleaf", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-tomcat", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.boot:spring-boot-starter-web", "moduleUrl": "https://spring.io/projects/spring-boot", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.data:spring-data-commons", "moduleUrl": "https://spring.io/projects/spring-data", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework.data:spring-data-jpa", "moduleUrl": "https://projects.spring.io/spring-data-jpa", - "moduleVersion": "3.2.1", + "moduleVersion": "3.2.2", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, @@ -768,77 +782,77 @@ { "moduleName": "org.springframework:spring-aop", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-aspects", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-beans", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-context", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-core", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-expression", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-jcl", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-jdbc", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-orm", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-tx", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, { "moduleName": "org.springframework:spring-web", "moduleUrl": "https://github.com/spring-projects/spring-framework", - "moduleVersion": "6.1.2", + "moduleVersion": "6.1.3", "moduleLicense": "Apache License, Version 2.0", "moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0" }, From 3f932ebec9799f0981809ca0560b07d4d16dc18e Mon Sep 17 00:00:00 2001 From: NeilJared Date: Tue, 6 Feb 2024 10:03:55 +0100 Subject: [PATCH 56/90] Update messages_es_ES.properties Updated es_ES translation (100%) --- src/main/resources/messages_es_ES.properties | 104 +++++++++---------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/main/resources/messages_es_ES.properties b/src/main/resources/messages_es_ES.properties index 538cc776..37bc5a06 100644 --- a/src/main/resources/messages_es_ES.properties +++ b/src/main/resources/messages_es_ES.properties @@ -42,9 +42,9 @@ red=Rojo green=Verde blue=Azul custom=Personalizado... -WorkInProgess=Work in progress, May not work or be buggy, Please report any ploblems! -poweredBy=Powered by -yes=Yes +WorkInProgess=Tarea en progreso, puede no funcionar o ralentizarse; ¡por favor, informe de cualquier problema! +poweredBy=Desarrollado por +yes=Sí no=No changedCredsMessage=Se cambiaron las credenciales! notAuthenticatedMessage=Usuario no autentificado. @@ -56,24 +56,24 @@ usernameExistsMessage=El nuevo nombre de usuario está en uso. ############### # Pipeline # ############### -pipeline.header=Pipeline Menu (Alpha) -pipeline.uploadButton=Upload Custom -pipeline.configureButton=Configure -pipeline.defaultOption=Custom -pipeline.submitButton=Submit +pipeline.header=Menu Pipeline (Alfa) +pipeline.uploadButton=Cargar personalización +pipeline.configureButton=Configurar +pipeline.defaultOption=Personalizar +pipeline.submitButton=Enviar ###################### # Pipeline Options # ###################### -pipelineOptions.header=Pipeline Configuration -pipelineOptions.pipelineNameLabel=Pipeline Name -pipelineOptions.saveSettings=Save Operation Settings -pipelineOptions.pipelineNamePrompt=Enter pipeline name here -pipelineOptions.selectOperation=Select Operation -pipelineOptions.addOperationButton=Add operation +pipelineOptions.header=Configuración Pipeline +pipelineOptions.pipelineNameLabel=Nombre del Pipeline +pipelineOptions.saveSettings=Guardar configuración de la oiperación +pipelineOptions.pipelineNamePrompt=Introduzca aquí el nombre del pipeline +pipelineOptions.selectOperation=Seleccione la operación +pipelineOptions.addOperationButton=Añadir operación pipelineOptions.pipelineHeader=Pipeline: -pipelineOptions.saveButton=Download -pipelineOptions.validateButton=Validate +pipelineOptions.saveButton=Descargar +pipelineOptions.validateButton=Validar @@ -466,37 +466,37 @@ HTMLToPDF.header=HTML a PDF HTMLToPDF.help=Acepta archivos HTML y ZIPs conteniendo los html/css/imágenes, etc, requeridas HTMLToPDF.submit=Convertir HTMLToPDF.credit=Utiliza WeasyPrint -HTMLToPDF.zoom=Zoom level for displaying the website. -HTMLToPDF.pageWidth=Width of the page in centimeters. (Blank to default) -HTMLToPDF.pageHeight=Height of the page in centimeters. (Blank to default) -HTMLToPDF.marginTop=Top margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginBottom=Bottom margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginLeft=Left margin of the page in millimeters. (Blank to default) -HTMLToPDF.marginRight=Right margin of the page in millimeters. (Blank to default) -HTMLToPDF.printBackground=Render the background of websites. -HTMLToPDF.defaultHeader=Enable Default Header (Name and page number) -HTMLToPDF.cssMediaType=Change the CSS media type of the page. -HTMLToPDF.none=None -HTMLToPDF.print=Print -HTMLToPDF.screen=Screen +HTMLToPDF.zoom=Nivel de zoom para mostrar la página web. +HTMLToPDF.pageWidth=Ancho de la página en centímetros. (Dejar en blanco por defecto) +HTMLToPDF.pageHeight=Alto de la página en centímetros. (Dejar en blanco por defecto) +HTMLToPDF.marginTop=Margen superior de la página en milímetros. (Dejar en blanco por defecto) +HTMLToPDF.marginBottom=Margen inferior de la página en milímetros. (Dejar en blanco por defecto) +HTMLToPDF.marginLeft=Margen izquierdo de la página en milímetros. (Dejar en blanco por defecto) +HTMLToPDF.marginRight=Margen derecho de la página en milímetros. (Dejar en blanco por defecto) +HTMLToPDF.printBackground=Renderizar el fondo de las páginas web. +HTMLToPDF.defaultHeader=Habilitar encabezado predeterminado (Nombre y número de página) +HTMLToPDF.cssMediaType=Cambiar el tipo de medio CSS de la página. +HTMLToPDF.none=Ninguno +HTMLToPDF.print=Imprimir +HTMLToPDF.screen=Pantalla #AddStampRequest -AddStampRequest.header=Stamp PDF -AddStampRequest.title=Stamp PDF -AddStampRequest.stampType=Stamp Type -AddStampRequest.stampText=Stamp Text -AddStampRequest.stampImage=Stamp Image -AddStampRequest.alphabet=Alphabet -AddStampRequest.fontSize=Font/Image Size -AddStampRequest.rotation=Rotation -AddStampRequest.opacity=Opacity -AddStampRequest.position=Position -AddStampRequest.overrideX=Override X Coordinate -AddStampRequest.overrideY=Override Y Coordinate -AddStampRequest.customMargin=Custom Margin -AddStampRequest.customColor=Custom Text Color -AddStampRequest.submit=Submit +AddStampRequest.header=Sellar PDF +AddStampRequest.title=Sellar PDF +AddStampRequest.stampType=Tipo de sello +AddStampRequest.stampText=Texto del sello +AddStampRequest.stampImage=Imagen de sello +AddStampRequest.alphabet=Alfabeto +AddStampRequest.fontSize=Tamaño de fuente/imagen +AddStampRequest.rotation=Rotación +AddStampRequest.opacity=Opacidad +AddStampRequest.position=Posición +AddStampRequest.overrideX=Forzar coordenada X +AddStampRequest.overrideY=Forzar coordenada Y +AddStampRequest.customMargin=Personalizar margen +AddStampRequest.customColor=Personalizar color de texto +AddStampRequest.submit=Enviar #sanitizePDF sanitizePDF.title=Desinfectar archivo PDF @@ -584,11 +584,11 @@ scalePages.submit=Entregar certSign.title=Firma con certificado certSign.header=Firmar un PDF con su certificado (en desarrollo) certSign.selectPDF=Seleccione un archivo PDF para firmar: -certSign.jksNote=Note: If your certificate type is not listed below, please convert it to a Java Keystore (.jks) file using the keytool command line tool. Then, choose the .jks file option below. +certSign.jksNote=Nota: si el tipo de certificado no está enla lista de abajo, por favor conviértalo a un archivo almacén de claves de Java Java KeyStore (.jks) utilizando la herramienta línea de comandos. Posteriormente, seleccione en el listado de abajo la opción archivo .jks. certSign.selectKey=Seleccione su archivo de clave privada (formato PKCS#8, podría ser .pem o .der): certSign.selectCert=Seleccione su archivo de certificado (formato X.509, podría ser .pem o .der): certSign.selectP12=Seleccione su archivo de almacén de claves PKCS#12 (.p12 o .pfx) (Opcional, si se proporciona, debe contener su clave privada y certificado): -certSign.selectJKS=Select Your Java Keystore File (.jks or .keystore): +certSign.selectJKS=Seleccione su archivo de almacén de claves Java KeyStore (.jks or .keystore): certSign.certType=Tipo de certificado certSign.password=Introduzca su almacén de claves o contraseña de clave privada (si corresponde): certSign.showSig=Mostrar firma @@ -961,11 +961,11 @@ split-by-sections.submit=Dividir PDF #licenses -licenses.nav=Licenses -licenses.title=3rd Party Licenses -licenses.header=3rd Party Licenses -licenses.module=Module -licenses.version=Version -licenses.license=License +licenses.nav=Licencias +licenses.title=Licencias de terceros +licenses.header=Licencias de terceros +licenses.module=Módulo +licenses.version=Versión +licenses.license=Licencia From aa2ad33c1d3e61c4f073a1865debcb3b05e376bc Mon Sep 17 00:00:00 2001 From: Zoey Date: Wed, 7 Feb 2024 06:15:32 +0100 Subject: [PATCH 57/90] fix libreoffice install --- DockerfileBase | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/DockerfileBase b/DockerfileBase index fd34ddf9..44e1a582 100644 --- a/DockerfileBase +++ b/DockerfileBase @@ -2,17 +2,19 @@ FROM alpine:3.19.0 # JDK for app -RUN apk add --no-cache \ +RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories && \ + apk add --no-cache \ ca-certificates \ tzdata \ tini \ bash \ curl \ - openjdk17-jre && \ + openjdk17-jre \ # Doc conversion - apk add --no-cache libreoffice --repository http://dl-cdn.alpinelinux.org/alpine/edge/community && \ + libreoffice@testing \ # OCR MY PDF (unpaper for descew and other advanced featues) - apk add --no-cache \ ocrmypdf \ tesseract-ocr-data-eng \ # CV @@ -22,7 +24,5 @@ RUN apk add --no-cache \ wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ # uno unoconv and HTML pip install --break-system-packages --no-cache-dir --upgrade unoconv WeasyPrint && \ - mv /usr/share/tessdata /usr/share/tessdata-original && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories + mv /usr/share/tessdata /usr/share/tessdata-original + From 4af58118c932b1cc6f0931d863995f77baed52e6 Mon Sep 17 00:00:00 2001 From: sbplat <71648843+sbplat@users.noreply.github.com> Date: Wed, 7 Feb 2024 21:40:33 -0500 Subject: [PATCH 58/90] fix: use the same margins for x and y in the stamp feature --- .../software/SPDF/LibreOfficeListener.java | 3 +- .../software/SPDF/SPdfApplication.java | 3 +- .../api/MultiPageLayoutController.java | 5 +- .../controller/api/PdfOverlayController.java | 5 +- .../api/RearrangePagesPDFController.java | 9 ++- .../controller/api/RotationController.java | 6 +- .../controller/api/ScalePagesController.java | 5 +- .../controller/api/SplitPDFController.java | 6 +- .../api/SplitPdfBySectionsController.java | 6 +- .../api/SplitPdfBySizeController.java | 6 +- .../ConvertBookToPDFController.java | 2 +- .../api/converters/ConvertHtmlToPDF.java | 2 +- .../converters/ConvertImgPDFController.java | 6 +- .../api/converters/ConvertMarkdownToPdf.java | 2 +- .../converters/ConvertOfficeController.java | 5 +- .../ConvertPDFToBookController.java | 5 +- .../api/converters/ConvertPDFToPDFA.java | 6 +- .../api/filters/FilterController.java | 2 +- .../api/misc/AutoRenameController.java | 5 +- .../api/misc/AutoSplitPdfController.java | 6 +- .../api/misc/BlankPageController.java | 5 +- .../api/misc/CompressController.java | 6 +- .../api/misc/ExtractImagesController.java | 6 +- .../api/misc/FakeScanControllerWIP.java | 6 +- .../api/misc/MetadataController.java | 6 +- .../controller/api/misc/OCRController.java | 10 ++- .../api/misc/OverlayImageController.java | 6 +- .../api/misc/PageNumbersController.java | 5 +- .../controller/api/misc/RepairController.java | 6 +- .../controller/api/misc/ShowJavascript.java | 5 +- .../controller/api/misc/StampController.java | 71 ++++++++++--------- .../api/pipeline/PipelineProcessor.java | 5 +- .../api/security/CertSignController.java | 6 +- .../api/security/PasswordController.java | 12 ++-- .../api/security/RedactController.java | 5 +- .../api/security/SanitizeController.java | 5 +- .../api/security/WatermarkController.java | 6 +- .../software/SPDF/utils/FileToPdf.java | 6 +- .../software/SPDF/utils/GeneralUtils.java | 9 +-- .../software/SPDF/utils/PDFToFile.java | 3 +- .../software/SPDF/utils/PdfUtils.java | 3 +- .../software/SPDF/utils/ProcessExecutor.java | 13 +++- .../software/SPDF/utils/WebResponseUtils.java | 3 +- 43 files changed, 187 insertions(+), 116 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/LibreOfficeListener.java b/src/main/java/stirling/software/SPDF/LibreOfficeListener.java index d8196dcd..96c4d270 100644 --- a/src/main/java/stirling/software/SPDF/LibreOfficeListener.java +++ b/src/main/java/stirling/software/SPDF/LibreOfficeListener.java @@ -1,12 +1,13 @@ package stirling.software.SPDF; -import io.github.pixee.security.SystemCommand; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import io.github.pixee.security.SystemCommand; + public class LibreOfficeListener { private static final long ACTIVITY_TIMEOUT = 20 * 60 * 1000; // 20 minutes diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index f37dfb6e..62cbfe10 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -1,6 +1,5 @@ package stirling.software.SPDF; -import io.github.pixee.security.SystemCommand; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; @@ -11,6 +10,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.core.env.Environment; import org.springframework.scheduling.annotation.EnableScheduling; +import io.github.pixee.security.SystemCommand; + import jakarta.annotation.PostConstruct; import stirling.software.SPDF.config.ConfigInitializer; import stirling.software.SPDF.utils.GeneralUtils; diff --git a/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java index b4949a58..adc5424d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -137,6 +137,7 @@ public class MultiPageLayoutController { byte[] result = baos.toByteArray(); return WebResponseUtils.bytesToWebResponse( result, - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_layoutChanged.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_layoutChanged.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java index f9938a39..a6148d4a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -77,7 +77,8 @@ public class PdfOverlayController { overlay.overlay(overlayGuide).save(outputStream); byte[] data = outputStream.toByteArray(); String outputFilename = - Filenames.toSimpleFileName(baseFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(baseFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_overlayed.pdf"; // Remove file extension and append .pdf return WebResponseUtils.bytesToWebResponse( diff --git a/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java index 3074f9f8..88bdcd91 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -58,7 +58,9 @@ public class RearrangePagesPDFController { } return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_removed_pages.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_removed_pages.pdf"); } private List removeFirst(int totalPages) { @@ -212,7 +214,8 @@ public class RearrangePagesPDFController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_rearranged.pdf"); } catch (IOException e) { logger.error("Failed rearranging documents", e); diff --git a/src/main/java/stirling/software/SPDF/controller/api/RotationController.java b/src/main/java/stirling/software/SPDF/controller/api/RotationController.java index 609e20f8..76f508d3 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RotationController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RotationController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -50,6 +50,8 @@ public class RotationController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_rotated.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_rotated.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java index 03994321..91cd012d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; @@ -23,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -113,6 +113,7 @@ public class ScalePagesController { return WebResponseUtils.bytesToWebResponse( baos.toByteArray(), - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_scaled.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_scaled.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java index c218788a..44c87464 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -24,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -84,7 +84,9 @@ public class SplitPDFController { Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { // loop through the split documents and write them to the zip file for (int i = 0; i < splitDocumentsBoas.size(); i++) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java index 2951a73e..3deb798e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -27,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -65,7 +65,9 @@ public class SplitPdfBySectionsController { sourceDocument.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java index eb2cfa28..45d2dd38 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Files; @@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -121,7 +121,9 @@ public class SplitPdfBySizeController { sourceDocument.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java index a266e871..3cbc783c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.ResponseEntity; @@ -10,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java index 2cf79992..189eebdf 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.ResponseEntity; @@ -10,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java index c131d883..86a70472 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertImgPDFController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.net.URLConnection; @@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -57,7 +57,9 @@ public class ConvertImgPDFController { // returns bytes for image boolean singleImage = "single".equals(singleOrMultiple); byte[] result = null; - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); try { result = PdfUtils.convertFromPdf( diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java index 39710ea0..050dd0fe 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.util.List; import java.util.Map; @@ -20,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java index ce3d9fe9..c6740b5f 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -90,7 +90,8 @@ public class ConvertOfficeController { byte[] pdfByteArray = convertToPdf(inputFile); return WebResponseUtils.bytesToWebResponse( pdfByteArray, - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_convertedToPDF.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java index 9711fc5e..c9171305 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -93,7 +93,8 @@ public class ConvertPDFToBookController { } String outputFilename = - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "." + outputFormat; // Remove file extension and append .pdf diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java index 5de8ee9a..41498413 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToPDFA.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.converters; -import io.github.pixee.security.Filenames; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -64,7 +64,9 @@ public class ConvertPDFToPDFA { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_PDFA.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_PDFA.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java b/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java index 6326cf19..9beaf413 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.filters; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -14,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java index 9000658c..2dc6c8a3 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.util.ArrayList; import java.util.Comparator; @@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -134,7 +134,8 @@ public class AutoRenameController { return WebResponseUtils.pdfDocToWebResponse(document, header + ".pdf"); } else { logger.info("File has no good title to be found"); - return WebResponseUtils.pdfDocToWebResponse(document, Filenames.toSimpleFileName(file.getOriginalFilename())); + return WebResponseUtils.pdfDocToWebResponse( + document, Filenames.toSimpleFileName(file.getOriginalFilename())); } } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java index da162d85..32f39c04 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; @@ -32,6 +31,7 @@ import com.google.zxing.PlanarYUVLuminanceSource; import com.google.zxing.Result; import com.google.zxing.common.HybridBinarizer; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -98,7 +98,9 @@ public class AutoSplitPdfController { document.close(); Path zipFile = Files.createTempFile("split_documents", ".zip"); - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); byte[] data; try (ZipOutputStream zipOut = new ZipOutputStream(Files.newOutputStream(zipFile))) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java index 34664a3b..b414a35b 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/BlankPageController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.image.BufferedImage; import java.io.IOException; import java.nio.file.Files; @@ -28,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -132,7 +132,8 @@ public class BlankPageController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_blanksRemoved.pdf"); } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java index c1b4a996..82a2c72f 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/CompressController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; @@ -30,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -265,7 +265,9 @@ public class CompressController { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_Optimized.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_Optimized.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java index cb9071d8..3931e2df 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImagesController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; @@ -30,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -67,7 +67,9 @@ public class ExtractImagesController { zos.setLevel(Deflater.BEST_COMPRESSION); int imageIndex = 1; - String filename = Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", ""); + String filename = + Filenames.toSimpleFileName(file.getOriginalFilename()) + .replaceFirst("[.][^.]+$", ""); int pageNum = 0; Set processedImages = new HashSet<>(); // Iterate over each page diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java index 8fb4af43..789bf17e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; @@ -34,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -142,7 +142,9 @@ public class FakeScanControllerWIP { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_scanned.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_scanned.pdf"; return WebResponseUtils.boasToWebResponse(baos, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java index 8e4ae664..fec07380 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -165,6 +165,8 @@ public class MetadataController { document.setDocumentInformation(info); return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_metadata.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_metadata.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java index 143ae1da..542e3c6d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/OCRController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -25,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -183,12 +183,16 @@ public class OCRController { // Return the OCR processed PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_OCR.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_OCR.pdf"; if (sidecar != null && sidecar) { // Create a zip file containing both the PDF and the text file String outputZipFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_OCR.zip"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_OCR.zip"; Path tempZipFile = Files.createTempFile("output_", ".zip"); try (ZipOutputStream zipOut = diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java index 01da177d..c3fad457 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.slf4j.Logger; @@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -45,7 +45,9 @@ public class OverlayImageController { return WebResponseUtils.bytesToWebResponse( result, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_overlayed.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_overlayed.pdf"); } catch (IOException e) { logger.error("Failed to add image to PDF", e); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java index cd99e9d0..337a9f48 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/PageNumbersController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -146,7 +146,8 @@ public class PageNumbersController { return WebResponseUtils.bytesToWebResponse( baos.toByteArray(), - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_numbersAdded.pdf", + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_numbersAdded.pdf", MediaType.APPLICATION_PDF); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java index caaaed5c..85d4560c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/RepairController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -66,7 +66,9 @@ public class RepairController { // Return the optimized PDF as a response String outputFilename = - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_repaired.pdf"; + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_repaired.pdf"; return WebResponseUtils.bytesToWebResponse(pdfBytes, outputFilename); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java index 0903a6e1..6accfb7a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.nio.charset.StandardCharsets; import java.util.Map; @@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -55,7 +55,8 @@ public class ShowJavascript { script += "// File: " - + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + + Filenames.toSimpleFileName( + inputFile.getOriginalFilename()) + ", Script: " + name + "\n" diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 52e8d970..99a5e2df 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; @@ -33,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -65,6 +65,7 @@ public class StampController { String customColor = request.getCustomColor(); float marginFactor; + switch (request.getCustomMargin().toLowerCase()) { case "small": marginFactor = 0.02f; @@ -78,7 +79,6 @@ public class StampController { case "x-large": marginFactor = 0.075f; break; - default: marginFactor = 0.035f; break; @@ -88,6 +88,9 @@ public class StampController { PDDocument document = Loader.loadPDF(pdfFile.getBytes()); for (PDPage page : document.getPages()) { + PDRectangle pageSize = page.getMediaBox(); + float margin = marginFactor * (pageSize.getWidth() + pageSize.getHeight()) / 2; + PDPageContentStream contentStream = new PDPageContentStream( document, page, PDPageContentStream.AppendMode.APPEND, true, true); @@ -108,7 +111,7 @@ public class StampController { alphabet, overrideX, overrideY, - marginFactor, + margin, customColor); } else if ("image".equalsIgnoreCase(watermarkType)) { addImageStamp( @@ -121,7 +124,7 @@ public class StampController { fontSize, overrideX, overrideY, - marginFactor); + margin); } contentStream.close(); @@ -129,7 +132,9 @@ public class StampController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_watermarked.pdf"); } private void addTextStamp( @@ -143,7 +148,7 @@ public class StampController { String alphabet, float overrideX, // X override float overrideY, - float marginFactor, + float margin, String colorString) // Y override throws IOException { String resourceDir = ""; @@ -205,14 +210,10 @@ public class StampController { } else { x = calculatePositionX( - pageSize, - position, - fontSize, - font, - fontSize, - watermarkText, - marginFactor); - y = calculatePositionY(pageSize, position, fontSize, marginFactor); + pageSize, position, fontSize, font, fontSize, watermarkText, margin); + y = + calculatePositionY( + pageSize, position, calculateTextCapHeight(font, fontSize), margin); } contentStream.beginText(); @@ -231,7 +232,7 @@ public class StampController { float fontSize, float overrideX, float overrideY, - float marginFactor) + float margin) throws IOException { // Load the watermark image @@ -257,10 +258,8 @@ public class StampController { x = overrideX; y = overrideY; } else { - x = - calculatePositionX( - pageSize, position, desiredPhysicalWidth, null, 0, null, marginFactor); - y = calculatePositionY(pageSize, position, fontSize, marginFactor); + x = calculatePositionX(pageSize, position, desiredPhysicalWidth, null, 0, null, margin); + y = calculatePositionY(pageSize, position, fontSize, margin); } contentStream.saveGraphicsState(); @@ -277,17 +276,31 @@ public class StampController { PDFont font, float fontSize, String text, - float marginFactor) + float margin) throws IOException { float actualWidth = (text != null) ? calculateTextWidth(text, font, fontSize) : contentWidth; switch (position % 3) { case 1: // Left - return pageSize.getLowerLeftX() + marginFactor * pageSize.getWidth(); + return pageSize.getLowerLeftX() + margin; case 2: // Center return (pageSize.getWidth() - actualWidth) / 2; case 0: // Right - return pageSize.getUpperRightX() - actualWidth - marginFactor * pageSize.getWidth(); + return pageSize.getUpperRightX() - actualWidth - margin; + default: + return 0; + } + } + + private float calculatePositionY( + PDRectangle pageSize, int position, float height, float margin) { + switch ((position - 1) / 3) { + case 0: // Top + return pageSize.getUpperRightY() - height - margin; + case 1: // Middle + return (pageSize.getHeight() - height) / 2; + case 2: // Bottom + return pageSize.getLowerLeftY() + margin; default: return 0; } @@ -297,17 +310,7 @@ public class StampController { return font.getStringWidth(text) / 1000 * fontSize; } - private float calculatePositionY( - PDRectangle pageSize, int position, float height, float marginFactor) { - switch ((position - 1) / 3) { - case 0: // Top - return pageSize.getUpperRightY() - height - marginFactor * pageSize.getHeight(); - case 1: // Middle - return (pageSize.getHeight() - height) / 2; - case 2: // Bottom - return pageSize.getLowerLeftY() + marginFactor * pageSize.getHeight(); - default: - return 0; - } + private float calculateTextCapHeight(PDFont font, float fontSize) { + return font.getFontDescriptor().getCapHeight() / 1000 * fontSize; } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java index c4e98bdb..c327cdd8 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineProcessor.java @@ -1,7 +1,5 @@ package stirling.software.SPDF.controller.api.pipeline; -import io.github.pixee.security.Filenames; -import io.github.pixee.security.ZipSecurity; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -38,6 +36,9 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; +import io.github.pixee.security.ZipSecurity; + import jakarta.servlet.ServletContext; import stirling.software.SPDF.SPdfApplication; import stirling.software.SPDF.model.PipelineConfig; diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java index 658f68f3..d066bd9a 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/CertSignController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -43,6 +42,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -124,7 +124,9 @@ public class CertSignController { ByteArrayOutputStream baos = new ByteArrayOutputStream(); sign(pdf.getBytes(), baos, createSignature, name, location, reason); return WebResponseUtils.boasToWebResponse( - baos, Filenames.toSimpleFileName(pdf.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_signed.pdf"); + baos, + Filenames.toSimpleFileName(pdf.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_signed.pdf"); } private static void sign( diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java index 328b753c..84c44933 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -16,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -44,7 +44,8 @@ public class PasswordController { document.setAllSecurityToBeRemoved(true); return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_password_removed.pdf"); } @@ -89,10 +90,13 @@ public class PasswordController { if ("".equals(ownerPassword) && "".equals(password)) return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_permissions.pdf"); return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(fileInput.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_passworded.pdf"); + Filenames.toSimpleFileName(fileInput.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_passworded.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java b/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java index 82ff54dd..0f482647 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; @@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -105,7 +105,8 @@ public class RedactController { byte[] pdfContent = baos.toByteArray(); return WebResponseUtils.bytesToWebResponse( pdfContent, - Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_redacted.pdf"); + Filenames.toSimpleFileName(file.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + "_redacted.pdf"); } private void redactFoundText( diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java b/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java index bbcfeeaa..6dfbf044 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/SanitizeController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.io.IOException; import org.apache.pdfbox.Loader; @@ -29,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -77,7 +77,8 @@ public class SanitizeController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + "_sanitized.pdf"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java index 91a8a265..9506822c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.controller.api.security; -import io.github.pixee.security.Filenames; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; @@ -32,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -106,7 +106,9 @@ public class WatermarkController { return WebResponseUtils.pdfDocToWebResponse( document, - Filenames.toSimpleFileName(pdfFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + "_watermarked.pdf"); + Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + "_watermarked.pdf"); } private void addTextWatermark( diff --git a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java index 09ce430c..90f7dbc3 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java +++ b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.ZipSecurity; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -13,6 +12,8 @@ import java.util.stream.Stream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import io.github.pixee.security.ZipSecurity; + import stirling.software.SPDF.model.api.converters.HTMLToPdfRequest; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; @@ -145,7 +146,8 @@ public class FileToPdf { private static Path unzipAndGetMainHtml(byte[] fileBytes) throws IOException { Path tempDirectory = Files.createTempDirectory("unzipped_"); - try (ZipInputStream zipIn = ZipSecurity.createHardenedInputStream(new ByteArrayInputStream(fileBytes))) { + try (ZipInputStream zipIn = + ZipSecurity.createHardenedInputStream(new ByteArrayInputStream(fileBytes))) { ZipEntry entry = zipIn.getNextEntry(); while (entry != null) { Path filePath = tempDirectory.resolve(entry.getName()); diff --git a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java index 1737b27e..7b1082b3 100644 --- a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java @@ -1,13 +1,10 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.HostValidator; -import io.github.pixee.security.Urls; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; -import java.net.URL; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; @@ -19,6 +16,9 @@ import java.util.List; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.HostValidator; +import io.github.pixee.security.Urls; + public class GeneralUtils { public static File convertMultipartFileToFile(MultipartFile multipartFile) throws IOException { @@ -59,7 +59,8 @@ public class GeneralUtils { public static boolean isValidURL(String urlStr) { try { - Urls.create(urlStr, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS); + Urls.create( + urlStr, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS); return true; } catch (MalformedURLException e) { return false; diff --git a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java index 7afe6a49..43683be8 100644 --- a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java +++ b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -21,6 +20,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; + import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; public class PDFToFile { diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index 748f8aad..77814340 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.Filenames; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; @@ -38,6 +37,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; + public class PdfUtils { private static final Logger logger = LoggerFactory.getLogger(PdfUtils.class); diff --git a/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java b/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java index f75367a7..2c81dce5 100644 --- a/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java +++ b/src/main/java/stirling/software/SPDF/utils/ProcessExecutor.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.BoundedLineReader; import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -17,6 +16,8 @@ import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import io.github.pixee.security.BoundedLineReader; + public class ProcessExecutor { private static final Logger logger = LoggerFactory.getLogger(ProcessExecutor.class); @@ -110,7 +111,10 @@ public class ProcessExecutor { process.getErrorStream(), StandardCharsets.UTF_8))) { String line; - while ((line = BoundedLineReader.readLine(errorReader, 5_000_000)) != null) { + while ((line = + BoundedLineReader.readLine( + errorReader, 5_000_000)) + != null) { errorLines.add(line); if (liveUpdates) logger.info(line); } @@ -131,7 +135,10 @@ public class ProcessExecutor { process.getInputStream(), StandardCharsets.UTF_8))) { String line; - while ((line = BoundedLineReader.readLine(outputReader, 5_000_000)) != null) { + while ((line = + BoundedLineReader.readLine( + outputReader, 5_000_000)) + != null) { outputLines.add(line); if (liveUpdates) logger.info(line); } diff --git a/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java b/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java index a85720e7..d148e65b 100644 --- a/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/WebResponseUtils.java @@ -1,6 +1,5 @@ package stirling.software.SPDF.utils; -import io.github.pixee.security.Filenames; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URLEncoder; @@ -13,6 +12,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; +import io.github.pixee.security.Filenames; + public class WebResponseUtils { public static ResponseEntity boasToWebResponse( From 4e937a6024662242171431918401466bfb108c70 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Thu, 8 Feb 2024 02:46:39 +0000 Subject: [PATCH 59/90] Sanitized user-provided file names in HTTP multipart uploads --- .../software/SPDF/controller/api/misc/ShowJavascript.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java index 6accfb7a..e1355c30 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java @@ -68,7 +68,7 @@ public class ShowJavascript { if (script.isEmpty()) { script = - "PDF '" + inputFile.getOriginalFilename() + "' does not contain Javascript"; + "PDF '" + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + "' does not contain Javascript"; } return WebResponseUtils.bytesToWebResponse( From 41686883ee8b4899f0cd04b9d53acffa8a69ebd8 Mon Sep 17 00:00:00 2001 From: mannam <101550345+ManoharMannam@users.noreply.github.com> Date: Thu, 8 Feb 2024 21:03:57 +0530 Subject: [PATCH 60/90] Fixed remove pages un-handled exception with space in input #761 --- .../resources/templates/remove-pages.html | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/src/main/resources/templates/remove-pages.html b/src/main/resources/templates/remove-pages.html index f86dc60e..ff4973f2 100644 --- a/src/main/resources/templates/remove-pages.html +++ b/src/main/resources/templates/remove-pages.html @@ -1,32 +1,38 @@ - - - - - - - -
-
-
-

-
-
-
-

- - -
-
- - -
- - -
-
-
-
-
-
- + + + + + + + + +
+
+
+

+
+
+
+

+ +
+
+
+ + +
+ +
+
+
+
+
+
+
+ + \ No newline at end of file From 9da88b7652835cdc17c18fae749d527bf39e1caf Mon Sep 17 00:00:00 2001 From: mannam <101550345+ManoharMannam@users.noreply.github.com> Date: Fri, 9 Feb 2024 19:35:34 +0530 Subject: [PATCH 61/90] fixed wrong filename generation through stamp tool #757 --- .../controller/api/misc/StampController.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 99a5e2df..bb467331 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -48,13 +48,13 @@ public class StampController { @Operation( summary = "Add stamp to a PDF file", description = - "This endpoint adds a stamp to a given PDF file. Users can specify the watermark type (text or image), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO") + "This endpoint adds a stamp to a given PDF file. Users can specify the stamp type (text or image), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO") public ResponseEntity addStamp(@ModelAttribute AddStampRequest request) throws IOException, Exception { MultipartFile pdfFile = request.getFileInput(); - String watermarkType = request.getStampType(); - String watermarkText = request.getStampText(); - MultipartFile watermarkImage = request.getStampImage(); + String stampType = request.getStampType(); + String stampText = request.getStampText(); + MultipartFile stampImage = request.getStampImage(); String alphabet = request.getAlphabet(); float fontSize = request.getFontSize(); float rotation = request.getRotation(); @@ -99,10 +99,10 @@ public class StampController { graphicsState.setNonStrokingAlphaConstant(opacity); contentStream.setGraphicsStateParameters(graphicsState); - if ("text".equalsIgnoreCase(watermarkType)) { + if ("text".equalsIgnoreCase(stampType)) { addTextStamp( contentStream, - watermarkText, + stampText, document, page, rotation, @@ -113,10 +113,10 @@ public class StampController { overrideY, margin, customColor); - } else if ("image".equalsIgnoreCase(watermarkType)) { + } else if ("image".equalsIgnoreCase(stampType)) { addImageStamp( contentStream, - watermarkImage, + stampImage, document, page, rotation, @@ -134,12 +134,12 @@ public class StampController { document, Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) .replaceFirst("[.][^.]+$", "") - + "_watermarked.pdf"); + + "_stamped.pdf"); } private void addTextStamp( PDPageContentStream contentStream, - String watermarkText, + String stampText, PDDocument document, PDPage page, float rotation, @@ -208,9 +208,7 @@ public class StampController { x = overrideX; y = overrideY; } else { - x = - calculatePositionX( - pageSize, position, fontSize, font, fontSize, watermarkText, margin); + x = calculatePositionX(pageSize, position, fontSize, font, fontSize, stampText, margin); y = calculatePositionY( pageSize, position, calculateTextCapHeight(font, fontSize), margin); @@ -218,13 +216,13 @@ public class StampController { contentStream.beginText(); contentStream.setTextMatrix(Matrix.getRotateInstance(Math.toRadians(rotation), x, y)); - contentStream.showText(watermarkText); + contentStream.showText(stampText); contentStream.endText(); } private void addImageStamp( PDPageContentStream contentStream, - MultipartFile watermarkImage, + MultipartFile stampImage, PDDocument document, PDPage page, float rotation, @@ -235,8 +233,8 @@ public class StampController { float margin) throws IOException { - // Load the watermark image - BufferedImage image = ImageIO.read(watermarkImage.getInputStream()); + // Load the stamp image + BufferedImage image = ImageIO.read(stampImage.getInputStream()); // Compute width based on original aspect ratio float aspectRatio = (float) image.getWidth() / (float) image.getHeight(); From 2473f0d034e2e19f497f1e48e1aa3c59a44f9389 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Fri, 9 Feb 2024 23:22:16 +0000 Subject: [PATCH 62/90] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7025b2bd..2e8bbbdf 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ plugins { import com.github.jk1.license.render.* group = 'stirling.software' -version = '0.20.2' +version = '0.21.0' sourceCompatibility = '17' repositories { From 15ad46fe1cb5cb14f83d4a9624db6f224550db9c Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Fri, 9 Feb 2024 23:24:25 +0000 Subject: [PATCH 63/90] book htmk --- .../SPDF/config/PostStartupProcesses.java | 27 +---- .../api/converters/ConvertPDFToOffice.java | 20 +++- .../software/SPDF/utils/FileToPdf.java | 104 ++++-------------- .../templates/convert/html-to-pdf.html | 59 +--------- .../templates/convert/pdf-to-text.html | 1 + 5 files changed, 45 insertions(+), 166 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java b/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java index 862e5f9e..e7b684ff 100644 --- a/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java +++ b/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java @@ -41,32 +41,13 @@ public class PostStartupProcesses { // Checking for DOCKER_INSTALL_BOOK_FORMATS environment variable if (bookFormatsInstalled) { List tmpList = new ArrayList<>(); - // Set up the timezone configuration commands - tmpList.addAll( - Arrays.asList( - "sh", - "-c", - "echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections; " - + "echo 'tzdata tzdata/Zones/Europe select Berlin' | debconf-set-selections")); - commands.add(tmpList); - // Install calibre with DEBIAN_FRONTEND set to noninteractive tmpList = new ArrayList<>(); - tmpList.addAll( - Arrays.asList( - "sh", - "-c", - "DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends calibre")); + tmpList.addAll(Arrays.asList("whoami")); commands.add(tmpList); - } - // Checking for DOCKER_INSTALL_HTML_FORMATS environment variable - if (htmlFormatsInstalled) { - List tmpList = new ArrayList<>(); - // Add -y flag for automatic yes to prompts and --no-install-recommends to reduce size - tmpList.addAll( - Arrays.asList( - "apt-get", "install", "wkhtmltopdf", "-y", "--no-install-recommends")); + tmpList = new ArrayList<>(); + tmpList.addAll(Arrays.asList("id")); commands.add(tmpList); } @@ -74,8 +55,6 @@ public class PostStartupProcesses { // Run the command if (runningInDocker) { List tmpList = new ArrayList<>(); - tmpList.addAll(Arrays.asList("apt-get", "update")); - commands.add(0, tmpList); for (List list : commands) { ProcessExecutorResult returnCode = diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java index 74b292b5..94e33982 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java @@ -2,13 +2,18 @@ package stirling.software.SPDF.controller.api.converters; import java.io.IOException; +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import org.apache.pdfbox.text.PDFTextStripper; +import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -17,6 +22,7 @@ import stirling.software.SPDF.model.api.converters.PdfToPresentationRequest; import stirling.software.SPDF.model.api.converters.PdfToTextOrRTFRequest; import stirling.software.SPDF.model.api.converters.PdfToWordRequest; import stirling.software.SPDF.utils.PDFToFile; +import stirling.software.SPDF.utils.WebResponseUtils; @RestController @RequestMapping("/api/v1/convert") @@ -59,9 +65,17 @@ public class ConvertPDFToOffice { throws IOException, InterruptedException { MultipartFile inputFile = request.getFileInput(); String outputFormat = request.getOutputFormat(); - - PDFToFile pdfToFile = new PDFToFile(); - return pdfToFile.processPdfToOfficeFormat(inputFile, outputFormat, "writer_pdf_import"); + if ("txt".equals(request.getOutputFormat())) { + try (PDDocument document = Loader.loadPDF(inputFile.getBytes())) { + PDFTextStripper stripper = new PDFTextStripper(); + String text = stripper.getText(document); + return WebResponseUtils.bytesToWebResponse(text.getBytes(), Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") + + ".txt" , MediaType.TEXT_PLAIN); + } + } else { + PDFToFile pdfToFile = new PDFToFile(); + return pdfToFile.processPdfToOfficeFormat(inputFile, outputFormat, "writer_pdf_import"); + } } @PostMapping(consumes = "multipart/form-data", value = "/pdf/word") diff --git a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java index 90f7dbc3..84f2596a 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java +++ b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java @@ -1,8 +1,9 @@ package stirling.software.SPDF.utils; import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileWriter; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -34,95 +35,40 @@ public class FileToPdf { tempInputFile = Files.createTempFile("input_", ".html"); Files.write(tempInputFile, fileBytes); } else { - tempInputFile = unzipAndGetMainHtml(fileBytes); + tempInputFile = Files.createTempFile("input_", ".zip"); + Files.write(tempInputFile, fileBytes); } List command = new ArrayList<>(); if (!htmlFormatsInstalled) { command.add("weasyprint"); - } else { - command.add("wkhtmltopdf"); - command.add("--enable-local-file-access"); - command.add("--load-error-handling"); - command.add("ignore"); - command.add("--load-media-error-handling"); - command.add("ignore"); - command.add("--zoom"); - command.add(String.valueOf(request.getZoom())); + command.add(tempInputFile.toString()); + command.add(tempOutputFile.toString()); + + } else { + command.add("ebook-convert"); + command.add(tempInputFile.toString()); + command.add(tempOutputFile.toString()); + command.add("--paper-size"); + command.add("a4"); - // if custom zoom add zoom style direct to html - // https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4900 if (request.getZoom() != 1.0) { - String htmlContent = new String(Files.readAllBytes(tempInputFile)); - - String zoomStyle = ""; - // Check for tag, add style tag to associated tag - if (htmlContent.contains("")) { - htmlContent = htmlContent.replace("", "" + zoomStyle); - } else if (htmlContent.contains("")) { - // If no tag, but tag exists - htmlContent = htmlContent.replace("", "" + zoomStyle); - } else { - // If neither nor tags exist - htmlContent = zoomStyle + htmlContent; + // Create a temporary CSS file + File tempCssFile = File.createTempFile("customStyle", ".css"); + try (FileWriter writer = new FileWriter(tempCssFile)) { + // Write the CSS rule to the file + writer.write("body { zoom: " + request.getZoom() + "; }"); } - // rewrite new html to file - Files.write(tempInputFile, htmlContent.getBytes(StandardCharsets.UTF_8)); - } - - if (request.getPageWidth() != null) { - command.add("--page-width"); - command.add(request.getPageWidth() + "cm"); - } - - if (request.getPageHeight() != null) { - command.add("--page-height"); - command.add(request.getPageHeight() + "cm"); - } - - if (request.getMarginTop() != null) { - command.add("--margin-top"); - command.add(request.getMarginTop() + "mm"); - } - - // Repeat similar pattern for marginBottom, marginLeft, marginRight - - if ("Yes".equalsIgnoreCase(request.getPrintBackground())) { - command.add("--background"); - } else { - command.add("--no-background"); - } - - if ("Yes".equalsIgnoreCase(request.getDefaultHeader())) { - command.add("--default-header"); - } - - if ("print".equalsIgnoreCase(request.getCssMediaType())) { - command.add("--print-media-type"); - } else if ("screen".equalsIgnoreCase(request.getCssMediaType())) { - command.add("--no-print-media-type"); + command.add("--extra-css"); + command.add(tempCssFile.getAbsolutePath()); } } - command.add(tempInputFile.toString()); - command.add(tempOutputFile.toString()); ProcessExecutorResult returnCode; - if (fileName.endsWith(".zip")) { - if (htmlFormatsInstalled) { - // command.add(1, "--allow"); - // command.add(2, tempInputFile.getParent().toString()); - } - returnCode = - ProcessExecutor.getInstance(ProcessExecutor.Processes.WEASYPRINT) - .runCommandWithOutputHandling( - command, tempInputFile.getParent().toFile()); - } else { - - returnCode = - ProcessExecutor.getInstance(ProcessExecutor.Processes.WEASYPRINT) - .runCommandWithOutputHandling(command); - } + returnCode = + ProcessExecutor.getInstance(ProcessExecutor.Processes.WEASYPRINT) + .runCommandWithOutputHandling(command); pdfBytes = Files.readAllBytes(tempOutputFile); } catch (IOException e) { @@ -135,10 +81,6 @@ public class FileToPdf { // Clean up temporary files Files.delete(tempOutputFile); Files.delete(tempInputFile); - - if (fileName.endsWith(".zip")) { - GeneralUtils.deleteDirectory(tempInputFile.getParent()); - } } return pdfBytes; diff --git a/src/main/resources/templates/convert/html-to-pdf.html b/src/main/resources/templates/convert/html-to-pdf.html index cbb22b99..534bed5f 100644 --- a/src/main/resources/templates/convert/html-to-pdf.html +++ b/src/main/resources/templates/convert/html-to-pdf.html @@ -19,64 +19,7 @@ - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - -
- - -
- - +
diff --git a/src/main/resources/templates/convert/pdf-to-text.html b/src/main/resources/templates/convert/pdf-to-text.html index 75b71d11..de649025 100644 --- a/src/main/resources/templates/convert/pdf-to-text.html +++ b/src/main/resources/templates/convert/pdf-to-text.html @@ -19,6 +19,7 @@
From 22343e507d061ee02d86e6d917bc49cd9451cbfd Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Fri, 9 Feb 2024 23:45:18 +0000 Subject: [PATCH 64/90] fixes --- Dockerfile | 33 ++++++++- Dockerfile-lite | 17 +++-- DockerfileBase | 28 -------- .../api/converters/ConvertPDFToOffice.java | 20 +++--- .../controller/api/misc/ShowJavascript.java | 4 +- .../controller/api/misc/StampController.java | 68 +++++++++---------- 6 files changed, 86 insertions(+), 84 deletions(-) delete mode 100644 DockerfileBase diff --git a/Dockerfile b/Dockerfile index 63bbc6b0..0479b5f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,32 @@ -# Use the base image -FROM frooodle/stirling-pdf-base:version8 +# Main stage +FROM alpine:3.19.0 + +# JDK for app +RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories && \ + apk add --no-cache \ + ca-certificates \ + tzdata \ + tini \ + bash \ + curl \ + openjdk17-jre \ +# Doc conversion + libreoffice@testing \ +# OCR MY PDF (unpaper for descew and other advanced featues) + ocrmypdf \ + tesseract-ocr-data-eng \ +# CV + py3-opencv \ +# python3/pip + python3 && \ + wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ +# uno unoconv and HTML + pip install --break-system-packages --no-cache-dir --upgrade unoconv WeasyPrint && \ + mv /usr/share/tessdata /usr/share/tessdata-original + + ARG VERSION_TAG @@ -24,7 +51,7 @@ COPY build/libs/*.jar app.jar ## useradd -u $PUID -g stirlingpdfgroup -s /bin/sh stirlingpdfuser && \ ## mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME && \ # Set up necessary directories and permissions -RUN mkdir /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders && \ +RUN mkdir -p /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders && \ ##&& \ ## chown -R stirlingpdfuser:stirlingpdfgroup /scripts /usr/share/fonts/opentype/noto /usr/share/tesseract-ocr /configs /customFiles && \ ## chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/tesseract-ocr-original && \ diff --git a/Dockerfile-lite b/Dockerfile-lite index 979d97de..5de060e6 100644 --- a/Dockerfile-lite +++ b/Dockerfile-lite @@ -20,17 +20,19 @@ COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto COPY build/libs/*.jar app.jar -RUN apk add --no-cache \ +RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ + echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories && \ + apk add --no-cache \ ca-certificates \ tzdata \ tini \ bash \ curl \ - openjdk17-jre && \ + openjdk17-jre \ # Doc conversion - apk add --no-cache libreoffice --repository http://dl-cdn.alpinelinux.org/alpine/edge/community && \ + libreoffice@testing \ # python and pip - apk add --no-cache \ python3 && \ wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ # uno unoconv and HTML @@ -40,14 +42,11 @@ RUN apk add --no-cache \ # useradd -u $PUID -g stirlingpdfgroup -s /bin/sh stirlingpdfuser && \ # mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME # Set up necessary directories and permissions - mkdir /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders && \ + mkdir -p /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders && \ # chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/fonts/opentype/noto /configs /customFiles # Set font cache and permissions fc-cache -f -v && \ - chmod +x /scripts/*.sh && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories + chmod +x /scripts/*.sh # chown stirlingpdfuser:stirlingpdfgroup /app.jar # Set environment variables diff --git a/DockerfileBase b/DockerfileBase deleted file mode 100644 index 44e1a582..00000000 --- a/DockerfileBase +++ /dev/null @@ -1,28 +0,0 @@ -# Main stage -FROM alpine:3.19.0 - -# JDK for app -RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \ - echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories && \ - apk add --no-cache \ - ca-certificates \ - tzdata \ - tini \ - bash \ - curl \ - openjdk17-jre \ -# Doc conversion - libreoffice@testing \ -# OCR MY PDF (unpaper for descew and other advanced featues) - ocrmypdf \ - tesseract-ocr-data-eng \ -# CV - py3-opencv \ -# python3/pip - python3 && \ - wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ -# uno unoconv and HTML - pip install --break-system-packages --no-cache-dir --upgrade unoconv WeasyPrint && \ - mv /usr/share/tessdata /usr/share/tessdata-original - diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java index 94e33982..798c5f44 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToOffice.java @@ -4,6 +4,7 @@ import java.io.IOException; import org.apache.pdfbox.Loader; import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.text.PDFTextStripper; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; @@ -11,7 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import org.apache.pdfbox.text.PDFTextStripper; import io.github.pixee.security.Filenames; import io.swagger.v3.oas.annotations.Operation; @@ -65,16 +65,20 @@ public class ConvertPDFToOffice { throws IOException, InterruptedException { MultipartFile inputFile = request.getFileInput(); String outputFormat = request.getOutputFormat(); - if ("txt".equals(request.getOutputFormat())) { - try (PDDocument document = Loader.loadPDF(inputFile.getBytes())) { + if ("txt".equals(request.getOutputFormat())) { + try (PDDocument document = Loader.loadPDF(inputFile.getBytes())) { PDFTextStripper stripper = new PDFTextStripper(); - String text = stripper.getText(document); - return WebResponseUtils.bytesToWebResponse(text.getBytes(), Filenames.toSimpleFileName(inputFile.getOriginalFilename()).replaceFirst("[.][^.]+$", "") - + ".txt" , MediaType.TEXT_PLAIN); + String text = stripper.getText(document); + return WebResponseUtils.bytesToWebResponse( + text.getBytes(), + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + .replaceFirst("[.][^.]+$", "") + + ".txt", + MediaType.TEXT_PLAIN); } } else { - PDFToFile pdfToFile = new PDFToFile(); - return pdfToFile.processPdfToOfficeFormat(inputFile, outputFormat, "writer_pdf_import"); + PDFToFile pdfToFile = new PDFToFile(); + return pdfToFile.processPdfToOfficeFormat(inputFile, outputFormat, "writer_pdf_import"); } } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java index e1355c30..a1f4f59c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java @@ -68,7 +68,9 @@ public class ShowJavascript { if (script.isEmpty()) { script = - "PDF '" + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + "' does not contain Javascript"; + "PDF '" + + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + + "' does not contain Javascript"; } return WebResponseUtils.bytesToWebResponse( diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index cfde30c1..9e53292e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -97,46 +97,44 @@ public class StampController { PDRectangle pageSize = page.getMediaBox(); float margin = marginFactor * (pageSize.getWidth() + pageSize.getHeight()) / 2; - PDPageContentStream contentStream = new PDPageContentStream( document, page, PDPageContentStream.AppendMode.APPEND, true, true); + PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState(); + graphicsState.setNonStrokingAlphaConstant(opacity); + contentStream.setGraphicsStateParameters(graphicsState); - PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState(); - graphicsState.setNonStrokingAlphaConstant(opacity); - contentStream.setGraphicsStateParameters(graphicsState); - - if ("text".equalsIgnoreCase(watermarkType)) { - addTextStamp( - contentStream, - watermarkText, - document, - page, - rotation, - position, - fontSize, - alphabet, - overrideX, - overrideY, - margin, - customColor); - } else if ("image".equalsIgnoreCase(watermarkType)) { - addImageStamp( - contentStream, - watermarkImage, - document, - page, - rotation, - position, - fontSize, - overrideX, - overrideY, - margin); - } - - contentStream.close(); - } + if ("text".equalsIgnoreCase(watermarkType)) { + addTextStamp( + contentStream, + watermarkText, + document, + page, + rotation, + position, + fontSize, + alphabet, + overrideX, + overrideY, + margin, + customColor); + } else if ("image".equalsIgnoreCase(watermarkType)) { + addImageStamp( + contentStream, + watermarkImage, + document, + page, + rotation, + position, + fontSize, + overrideX, + overrideY, + margin); + } + + contentStream.close(); + } } return WebResponseUtils.pdfDocToWebResponse( document, From 96e399a617122e64a1fcd23e9957d6c4038aa744 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 10 Feb 2024 00:00:07 +0000 Subject: [PATCH 65/90] changing html and book labels --- .../software/SPDF/config/AppConfig.java | 11 ++---- .../SPDF/config/EndpointConfiguration.java | 10 +++--- .../SPDF/config/PostStartupProcesses.java | 16 +++------ .../ConvertBookToPDFController.java | 10 +++--- .../ConvertPDFToBookController.java | 10 +++--- .../web/ConverterWebController.java | 4 +-- .../SPDF/model/ApplicationProperties.java | 25 ++++--------- .../api/converters/HTMLToPdfRequest.java | 35 ------------------- src/main/resources/settings.yml.template | 3 +- 9 files changed, 32 insertions(+), 92 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/config/AppConfig.java b/src/main/java/stirling/software/SPDF/config/AppConfig.java index c1a646ad..65e98b7f 100644 --- a/src/main/java/stirling/software/SPDF/config/AppConfig.java +++ b/src/main/java/stirling/software/SPDF/config/AppConfig.java @@ -77,16 +77,11 @@ public class AppConfig { return Files.exists(Paths.get("/.dockerenv")); } - @Bean(name = "bookFormatsInstalled") - public boolean bookFormatsInstalled() { - return applicationProperties.getSystem().getCustomApplications().isInstallBookFormats(); - } - - @Bean(name = "htmlFormatsInstalled") - public boolean htmlFormatsInstalled() { + @Bean(name = "bookAndHtmlFormatsInstalled") + public boolean bookAndHtmlFormatsInstalled() { return applicationProperties .getSystem() .getCustomApplications() - .isInstallAdvancedHtmlToPDF(); + .isInstallBookAndHtmlFormats(); } } diff --git a/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java b/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java index f1e328f9..f82c189f 100644 --- a/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java +++ b/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java @@ -16,7 +16,7 @@ import org.springframework.stereotype.Service; import stirling.software.SPDF.model.ApplicationProperties; @Service -@DependsOn({"bookFormatsInstalled"}) +@DependsOn({"bookAndHtmlFormatsInstalled"}) public class EndpointConfiguration { private static final Logger logger = LoggerFactory.getLogger(EndpointConfiguration.class); private Map endpointStatuses = new ConcurrentHashMap<>(); @@ -24,14 +24,14 @@ public class EndpointConfiguration { private final ApplicationProperties applicationProperties; - private boolean bookFormatsInstalled; + private boolean bookAndHtmlFormatsInstalled; @Autowired public EndpointConfiguration( ApplicationProperties applicationProperties, - @Qualifier("bookFormatsInstalled") boolean bookFormatsInstalled) { + @Qualifier("bookAndHtmlFormatsInstalled") boolean bookAndHtmlFormatsInstalled) { this.applicationProperties = applicationProperties; - this.bookFormatsInstalled = bookFormatsInstalled; + this.bookAndHtmlFormatsInstalled = bookAndHtmlFormatsInstalled; init(); processEnvironmentConfigs(); } @@ -229,7 +229,7 @@ public class EndpointConfiguration { private void processEnvironmentConfigs() { List endpointsToRemove = applicationProperties.getEndpoints().getToRemove(); List groupsToRemove = applicationProperties.getEndpoints().getGroupsToRemove(); - if (!bookFormatsInstalled) { + if (!bookAndHtmlFormatsInstalled) { groupsToRemove.add("Calibre"); } if (endpointsToRemove != null) { diff --git a/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java b/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java index e7b684ff..2041cf95 100644 --- a/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java +++ b/src/main/java/stirling/software/SPDF/config/PostStartupProcesses.java @@ -26,12 +26,8 @@ public class PostStartupProcesses { private boolean runningInDocker; @Autowired - @Qualifier("bookFormatsInstalled") - private boolean bookFormatsInstalled; - - @Autowired - @Qualifier("htmlFormatsInstalled") - private boolean htmlFormatsInstalled; + @Qualifier("bookAndHtmlFormatsInstalled") + private boolean bookAndHtmlFormatsInstalled; private static final Logger logger = LoggerFactory.getLogger(PostStartupProcesses.class); @@ -39,15 +35,11 @@ public class PostStartupProcesses { public void runInstallCommandBasedOnEnvironment() throws IOException, InterruptedException { List> commands = new ArrayList<>(); // Checking for DOCKER_INSTALL_BOOK_FORMATS environment variable - if (bookFormatsInstalled) { + if (bookAndHtmlFormatsInstalled) { List tmpList = new ArrayList<>(); tmpList = new ArrayList<>(); - tmpList.addAll(Arrays.asList("whoami")); - commands.add(tmpList); - - tmpList = new ArrayList<>(); - tmpList.addAll(Arrays.asList("id")); + tmpList.addAll(Arrays.asList("apk add --no-cache calibre")); commands.add(tmpList); } diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java index 3cbc783c..05784a15 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertBookToPDFController.java @@ -23,21 +23,21 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class ConvertBookToPDFController { @Autowired - @Qualifier("bookFormatsInstalled") - private boolean bookFormatsInstalled; + @Qualifier("bookAndHtmlFormatsInstalled") + private boolean bookAndHtmlFormatsInstalled; @PostMapping(consumes = "multipart/form-data", value = "/book/pdf") @Operation( summary = "Convert a BOOK/comic (*.epub | *.mobi | *.azw3 | *.fb2 | *.txt | *.docx) to PDF", description = - "(Requires bookFormatsInstalled flag and Calibre installed) This endpoint takes an BOOK/comic (*.epub | *.mobi | *.azw3 | *.fb2 | *.txt | *.docx) input and converts it to PDF format.") + "(Requires bookAndHtmlFormatsInstalled flag and Calibre installed) This endpoint takes an BOOK/comic (*.epub | *.mobi | *.azw3 | *.fb2 | *.txt | *.docx) input and converts it to PDF format.") public ResponseEntity HtmlToPdf(@ModelAttribute GeneralFile request) throws Exception { MultipartFile fileInput = request.getFileInput(); - if (!bookFormatsInstalled) { + if (!bookAndHtmlFormatsInstalled) { throw new IllegalArgumentException( - "bookFormatsInstalled flag is False, this functionality is not avaiable"); + "bookAndHtmlFormatsInstalled flag is False, this functionality is not avaiable"); } if (fileInput == null) { diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java index c9171305..28793d48 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToBookController.java @@ -30,22 +30,22 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class ConvertPDFToBookController { @Autowired - @Qualifier("bookFormatsInstalled") - private boolean bookFormatsInstalled; + @Qualifier("bookAndHtmlFormatsInstalled") + private boolean bookAndHtmlFormatsInstalled; @PostMapping(consumes = "multipart/form-data", value = "/pdf/book") @Operation( summary = "Convert a PDF to a Book/comic (*.epub | *.mobi | *.azw3 | *.fb2 | *.txt | *.docx .. (others to include by chatgpt) to PDF", description = - "(Requires bookFormatsInstalled flag and Calibre installed) This endpoint Convert a PDF to a Book/comic (*.epub | *.mobi | *.azw3 | *.fb2 | *.txt | *.docx .. (others to include by chatgpt) to PDF") + "(Requires bookAndHtmlFormatsInstalled flag and Calibre installed) This endpoint Convert a PDF to a Book/comic (*.epub | *.mobi | *.azw3 | *.fb2 | *.txt | *.docx .. (others to include by chatgpt) to PDF") public ResponseEntity HtmlToPdf(@ModelAttribute PdfToBookRequest request) throws Exception { MultipartFile fileInput = request.getFileInput(); - if (!bookFormatsInstalled) { + if (!bookAndHtmlFormatsInstalled) { throw new IllegalArgumentException( - "bookFormatsInstalled flag is False, this functionality is not avaiable"); + "bookAndHtmlFormatsInstalled flag is False, this functionality is not avaiable"); } if (fileInput == null) { diff --git a/src/main/java/stirling/software/SPDF/controller/web/ConverterWebController.java b/src/main/java/stirling/software/SPDF/controller/web/ConverterWebController.java index 55ebcb91..23270df5 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/ConverterWebController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/ConverterWebController.java @@ -13,7 +13,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; @Tag(name = "Convert", description = "Convert APIs") public class ConverterWebController { - @ConditionalOnExpression("#{bookFormatsInstalled}") + @ConditionalOnExpression("#{bookAndHtmlFormatsInstalled}") @GetMapping("/book-to-pdf") @Hidden public String convertBookToPdfForm(Model model) { @@ -21,7 +21,7 @@ public class ConverterWebController { return "convert/book-to-pdf"; } - @ConditionalOnExpression("#{bookFormatsInstalled}") + @ConditionalOnExpression("#{bookAndHtmlFormatsInstalled}") @GetMapping("/pdf-to-book") @Hidden public String convertPdfToBookForm(Model model) { diff --git a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java index 3258d8b1..34c60bbe 100644 --- a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java +++ b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java @@ -290,31 +290,20 @@ public class ApplicationProperties { } public static class CustomApplications { - private boolean installBookFormats; - private boolean installAdvancedHtmlToPDF; + private boolean installBookAndHtmlFormats; - public boolean isInstallBookFormats() { - return installBookFormats; + public boolean isInstallBookAndHtmlFormats() { + return installBookAndHtmlFormats; } - public void setInstallBookFormats(boolean installBookFormats) { - this.installBookFormats = installBookFormats; - } - - public boolean isInstallAdvancedHtmlToPDF() { - return installAdvancedHtmlToPDF; - } - - public void setInstallAdvancedHtmlToPDF(boolean installAdvancedHtmlToPDF) { - this.installAdvancedHtmlToPDF = installAdvancedHtmlToPDF; + public void setInstallBookAndHtmlFormats(boolean installBookAndHtmlFormats) { + this.installBookAndHtmlFormats = installBookAndHtmlFormats; } @Override public String toString() { - return "CustomApplications [installBookFormats=" - + installBookFormats - + ", installAdvancedHtmlToPDF=" - + installAdvancedHtmlToPDF + return "CustomApplications [installBookAndHtmlFormats=" + + installBookAndHtmlFormats + "]"; } } diff --git a/src/main/java/stirling/software/SPDF/model/api/converters/HTMLToPdfRequest.java b/src/main/java/stirling/software/SPDF/model/api/converters/HTMLToPdfRequest.java index c778c36f..5f5ae051 100644 --- a/src/main/java/stirling/software/SPDF/model/api/converters/HTMLToPdfRequest.java +++ b/src/main/java/stirling/software/SPDF/model/api/converters/HTMLToPdfRequest.java @@ -14,39 +14,4 @@ public class HTMLToPdfRequest extends PDFFile { description = "Zoom level for displaying the website. Default is '1'.", defaultValue = "1") private float zoom; - - @Schema(description = "Width of the page in centimeters.") - private Float pageWidth; - - @Schema(description = "Height of the page in centimeters.") - private Float pageHeight; - - @Schema(description = "Top margin of the page in millimeters.") - private Float marginTop; - - @Schema(description = "Bottom margin of the page in millimeters.") - private Float marginBottom; - - @Schema(description = "Left margin of the page in millimeters.") - private Float marginLeft; - - @Schema(description = "Right margin of the page in millimeters.") - private Float marginRight; - - @Schema( - description = "Enable or disable rendering of website background.", - allowableValues = {"Yes", "No"}) - private String printBackground; - - @Schema( - description = - "Enable or disable the default header. The default header includes the name of the page on the left and the page number on the right.", - allowableValues = {"Yes", "No"}) - private String defaultHeader; - - @Schema( - description = "Change the CSS media type of the page. Defaults to 'print'.", - allowableValues = {"none", "print", "screen"}, - defaultValue = "print") - private String cssMediaType; } diff --git a/src/main/resources/settings.yml.template b/src/main/resources/settings.yml.template index 00c5998e..368a6a43 100644 --- a/src/main/resources/settings.yml.template +++ b/src/main/resources/settings.yml.template @@ -14,8 +14,7 @@ system: googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes) customApplications: - installBookFormats: false # Installs Calibre for book format conversion (For non docker it must be manually downloaded but will need to be true to show in UI) - installAdvancedHtmlToPDF: false # DO NOT USE EXTERNALLY, NOT SAFE! Install wkHtmlToPDF (For non docker it must be manually downloaded but will need to be true to show in UI) + installBookAndHtmlFormats: false # Installs Calibre for book format conversion (For non docker it must be manually downloaded but will need to be true to show in UI) #ui: # appName: exampleAppName # Application's visible name From 68c094166603bd0a5c54ff3706fc4bb2ca68bdf9 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Sat, 10 Feb 2024 00:08:18 +0000 Subject: [PATCH 66/90] Sanitized user-provided file names in HTTP multipart uploads --- .../software/SPDF/controller/api/misc/ShowJavascript.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java index a1f4f59c..0a93bf1d 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/ShowJavascript.java @@ -75,7 +75,7 @@ public class ShowJavascript { return WebResponseUtils.bytesToWebResponse( script.getBytes(StandardCharsets.UTF_8), - inputFile.getOriginalFilename() + ".js"); + Filenames.toSimpleFileName(inputFile.getOriginalFilename()) + ".js"); } } } From 23672cd18d968fac55a9ccb4b1fb63a4cc0d9697 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Sat, 10 Feb 2024 00:08:18 +0000 Subject: [PATCH 67/90] Modernize and secure temp file creation --- src/main/java/stirling/software/SPDF/utils/FileToPdf.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java index 84f2596a..da408a23 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java +++ b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java @@ -54,7 +54,7 @@ public class FileToPdf { if (request.getZoom() != 1.0) { // Create a temporary CSS file - File tempCssFile = File.createTempFile("customStyle", ".css"); + File tempCssFile = Files.createTempFile("customStyle", ".css").toFile(); try (FileWriter writer = new FileWriter(tempCssFile)) { // Write the CSS rule to the file writer.write("body { zoom: " + request.getZoom() + "; }"); From 5a52e3d6dde1a6f6d82a344edd5ed8fe3f09547d Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 10 Feb 2024 00:08:54 +0000 Subject: [PATCH 68/90] other changes --- .../SPDF/controller/api/converters/ConvertHtmlToPDF.java | 6 +++--- .../SPDF/controller/api/converters/ConvertWebsiteToPDF.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java index 189eebdf..9945ad2b 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java @@ -23,8 +23,8 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class ConvertHtmlToPDF { @Autowired - @Qualifier("htmlFormatsInstalled") - private boolean htmlFormatsInstalled; + @Qualifier("installBookAndHtmlFormats") + private boolean installBookAndHtmlFormats; @PostMapping(consumes = "multipart/form-data", value = "/html/pdf") @Operation( @@ -47,7 +47,7 @@ public class ConvertHtmlToPDF { } byte[] pdfBytes = FileToPdf.convertHtmlToPdf( - request, fileInput.getBytes(), originalFilename, htmlFormatsInstalled); + request, fileInput.getBytes(), originalFilename, installBookAndHtmlFormats); String outputFilename = originalFilename.replaceFirst("[.][^.]+$", "") diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java index a6cd439b..7fb4eeec 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java @@ -29,8 +29,8 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class ConvertWebsiteToPDF { @Autowired - @Qualifier("htmlFormatsInstalled") - private boolean htmlFormatsInstalled; + @Qualifier("installBookAndHtmlFormats") + private boolean installBookAndHtmlFormats; @PostMapping(consumes = "multipart/form-data", value = "/url/pdf") @Operation( @@ -53,7 +53,7 @@ public class ConvertWebsiteToPDF { // Prepare the OCRmyPDF command List command = new ArrayList<>(); - if (!htmlFormatsInstalled) { + if (!installBookAndHtmlFormats) { command.add("weasyprint"); } else { command.add("wkhtmltopdf"); From 6f72096953e932022c1f3803db72733ffdd399ce Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 10 Feb 2024 00:21:00 +0000 Subject: [PATCH 69/90] more fixes --- .../SPDF/controller/api/converters/ConvertHtmlToPDF.java | 9 ++++++--- .../controller/api/converters/ConvertMarkdownToPdf.java | 9 ++++++--- .../controller/api/converters/ConvertWebsiteToPDF.java | 6 +++--- src/main/resources/settings.yml.template | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java index 9945ad2b..c7cfc196 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java @@ -23,8 +23,8 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class ConvertHtmlToPDF { @Autowired - @Qualifier("installBookAndHtmlFormats") - private boolean installBookAndHtmlFormats; + @Qualifier("bookAndHtmlFormatsInstalled") + private boolean bookAndHtmlFormatsInstalled; @PostMapping(consumes = "multipart/form-data", value = "/html/pdf") @Operation( @@ -47,7 +47,10 @@ public class ConvertHtmlToPDF { } byte[] pdfBytes = FileToPdf.convertHtmlToPdf( - request, fileInput.getBytes(), originalFilename, installBookAndHtmlFormats); + request, + fileInput.getBytes(), + originalFilename, + bookAndHtmlFormatsInstalled); String outputFilename = originalFilename.replaceFirst("[.][^.]+$", "") diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java index 050dd0fe..9cefe1ff 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertMarkdownToPdf.java @@ -33,8 +33,8 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class ConvertMarkdownToPdf { @Autowired - @Qualifier("htmlFormatsInstalled") - private boolean htmlFormatsInstalled; + @Qualifier("bookAndHtmlFormatsInstalled") + private boolean bookAndHtmlFormatsInstalled; @PostMapping(consumes = "multipart/form-data", value = "/markdown/pdf") @Operation( @@ -69,7 +69,10 @@ public class ConvertMarkdownToPdf { byte[] pdfBytes = FileToPdf.convertHtmlToPdf( - null, htmlContent.getBytes(), "converted.html", htmlFormatsInstalled); + null, + htmlContent.getBytes(), + "converted.html", + bookAndHtmlFormatsInstalled); String outputFilename = originalFilename.replaceFirst("[.][^.]+$", "") diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java index 7fb4eeec..c2d25973 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java @@ -29,8 +29,8 @@ import stirling.software.SPDF.utils.WebResponseUtils; public class ConvertWebsiteToPDF { @Autowired - @Qualifier("installBookAndHtmlFormats") - private boolean installBookAndHtmlFormats; + @Qualifier("bookAndHtmlFormatsInstalled") + private boolean bookAndHtmlFormatsInstalled; @PostMapping(consumes = "multipart/form-data", value = "/url/pdf") @Operation( @@ -53,7 +53,7 @@ public class ConvertWebsiteToPDF { // Prepare the OCRmyPDF command List command = new ArrayList<>(); - if (!installBookAndHtmlFormats) { + if (!bookAndHtmlFormatsInstalled) { command.add("weasyprint"); } else { command.add("wkhtmltopdf"); diff --git a/src/main/resources/settings.yml.template b/src/main/resources/settings.yml.template index 368a6a43..52a84bf4 100644 --- a/src/main/resources/settings.yml.template +++ b/src/main/resources/settings.yml.template @@ -14,7 +14,7 @@ system: googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes) customApplications: - installBookAndHtmlFormats: false # Installs Calibre for book format conversion (For non docker it must be manually downloaded but will need to be true to show in UI) + bookAndHtmlFormatsInstalled: false # Installs Calibre for book format conversion (For non docker it must be manually downloaded but will need to be true to show in UI) #ui: # appName: exampleAppName # Application's visible name From e1c3561997bb8db4de19cada7dd16cba9fd96630 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 10 Feb 2024 10:29:17 +0000 Subject: [PATCH 70/90] version bump and expose ports --- Dockerfile | 4 +++- Dockerfile-lite | 4 +++- Dockerfile-ultra-lite | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0479b5f9..e473931d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Main stage -FROM alpine:3.19.0 +FROM alpine:3.19.1 # JDK for app RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \ @@ -61,6 +61,8 @@ RUN mkdir -p /configs /logs /customFiles /pipeline/watchedFolders /pipeline/fin ## chown stirlingpdfuser:stirlingpdfgroup /app.jar && \ ## chmod +x /scripts/init.sh +EXPOSE 8080 + # Set user and run command ##USER stirlingpdfuser ENTRYPOINT ["tini", "--", "/scripts/init.sh"] diff --git a/Dockerfile-lite b/Dockerfile-lite index 5de060e6..f7dfa219 100644 --- a/Dockerfile-lite +++ b/Dockerfile-lite @@ -1,5 +1,5 @@ # use alpine -FROM alpine:3.19.0 +FROM alpine:3.19.1 ARG VERSION_TAG @@ -53,6 +53,8 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /et ENV ENDPOINTS_GROUPS_TO_REMOVE=OpenCV,OCRmyPDF ENV DOCKER_ENABLE_SECURITY=false +EXPOSE 8080 + # Run the application #USER stirlingpdfuser ENTRYPOINT ["tini", "--", "/scripts/init-without-ocr.sh"] diff --git a/Dockerfile-ultra-lite b/Dockerfile-ultra-lite index e01debb0..d602a361 100644 --- a/Dockerfile-ultra-lite +++ b/Dockerfile-ultra-lite @@ -1,5 +1,5 @@ # use alpine -FROM alpine:3.19.0 +FROM alpine:3.19.1 ARG VERSION_TAG @@ -43,6 +43,8 @@ RUN mkdir /configs /logs /customFiles && \ # Set environment variables ENV ENDPOINTS_GROUPS_TO_REMOVE=CLI +EXPOSE 8080 + ENTRYPOINT ["tini", "--", "/scripts/init-without-ocr.sh"] # Run the application From a4f923eb3a0c7f26cce156177dba92d57d8f0942 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 10 Feb 2024 11:19:22 +0000 Subject: [PATCH 71/90] Update StampController.java --- .../controller/api/misc/StampController.java | 39 +------------------ 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index eec48821..68a65d71 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -88,44 +88,7 @@ public class StampController { // Load the input PDF PDDocument document = Loader.loadPDF(pdfFile.getBytes()); - for (PDPage page : document.getPages()) { - PDRectangle pageSize = page.getMediaBox(); - float margin = marginFactor * (pageSize.getWidth() + pageSize.getHeight()) / 2; - - PDPageContentStream contentStream = - new PDPageContentStream( - document, page, PDPageContentStream.AppendMode.APPEND, true, true); - - PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState(); - graphicsState.setNonStrokingAlphaConstant(opacity); - contentStream.setGraphicsStateParameters(graphicsState); - - if ("text".equalsIgnoreCase(stampType)) { - addTextStamp( - contentStream, - stampText, - document, - page, - rotation, - position, - fontSize, - alphabet, - overrideX, - overrideY, - margin, - customColor); - } else if ("image".equalsIgnoreCase(stampType)) { - addImageStamp( - contentStream, - stampImage, - document, - page, - rotation, - position, - fontSize, - overrideX, - overrideY, - margin); + List pageNumbers = request.getPageNumbersList(); From 0fabfea56d598e935f3550ee470d64dc960d7514 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 10 Feb 2024 14:52:27 +0000 Subject: [PATCH 72/90] page adjusts for stamp --- .../controller/api/SplitPDFController.java | 2 +- .../controller/api/misc/StampController.java | 38 +++++++++---------- .../SPDF/model/api/PDFWithPageNums.java | 11 +++--- .../software/SPDF/utils/GeneralUtils.java | 21 +++++++--- src/main/resources/messages_en_GB.properties | 1 + src/main/resources/templates/misc/stamp.html | 6 +++ 6 files changed, 48 insertions(+), 31 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java index 44c87464..a69dea34 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java @@ -50,7 +50,7 @@ public class SplitPDFController { PDDocument document = Loader.loadPDF(file.getBytes()); - List pageNumbers = request.getPageNumbersList(document); + List pageNumbers = request.getPageNumbersList(document, true); if (!pageNumbers.contains(document.getNumberOfPages() - 1)) pageNumbers.add(document.getNumberOfPages() - 1); logger.info( diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java index 9e53292e..e11ffbaf 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java @@ -49,13 +49,13 @@ public class StampController { @Operation( summary = "Add stamp to a PDF file", description = - "This endpoint adds a stamp to a given PDF file. Users can specify the watermark type (text or image), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO") + "This endpoint adds a stamp to a given PDF file. Users can specify the stamp type (text or image), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO") public ResponseEntity addStamp(@ModelAttribute AddStampRequest request) throws IOException, Exception { MultipartFile pdfFile = request.getFileInput(); - String watermarkType = request.getStampType(); - String watermarkText = request.getStampText(); - MultipartFile watermarkImage = request.getStampImage(); + String stampType = request.getStampType(); + String stampText = request.getStampText(); + MultipartFile stampImage = request.getStampImage(); String alphabet = request.getAlphabet(); float fontSize = request.getFontSize(); float rotation = request.getRotation(); @@ -88,7 +88,9 @@ public class StampController { // Load the input PDF PDDocument document = Loader.loadPDF(pdfFile.getBytes()); - List pageNumbers = request.getPageNumbersList(); + + + List pageNumbers = request.getPageNumbersList(document, false); for (int pageIndex : pageNumbers) { int zeroBasedIndex = pageIndex - 1; @@ -105,10 +107,10 @@ public class StampController { graphicsState.setNonStrokingAlphaConstant(opacity); contentStream.setGraphicsStateParameters(graphicsState); - if ("text".equalsIgnoreCase(watermarkType)) { + if ("text".equalsIgnoreCase(stampType)) { addTextStamp( contentStream, - watermarkText, + stampText, document, page, rotation, @@ -119,10 +121,10 @@ public class StampController { overrideY, margin, customColor); - } else if ("image".equalsIgnoreCase(watermarkType)) { + } else if ("image".equalsIgnoreCase(stampType)) { addImageStamp( contentStream, - watermarkImage, + stampImage, document, page, rotation, @@ -140,12 +142,12 @@ public class StampController { document, Filenames.toSimpleFileName(pdfFile.getOriginalFilename()) .replaceFirst("[.][^.]+$", "") - + "_watermarked.pdf"); + + "_stamped.pdf"); } private void addTextStamp( PDPageContentStream contentStream, - String watermarkText, + String stampText, PDDocument document, PDPage page, float rotation, @@ -214,9 +216,7 @@ public class StampController { x = overrideX; y = overrideY; } else { - x = - calculatePositionX( - pageSize, position, fontSize, font, fontSize, watermarkText, margin); + x = calculatePositionX(pageSize, position, fontSize, font, fontSize, stampText, margin); y = calculatePositionY( pageSize, position, calculateTextCapHeight(font, fontSize), margin); @@ -224,13 +224,13 @@ public class StampController { contentStream.beginText(); contentStream.setTextMatrix(Matrix.getRotateInstance(Math.toRadians(rotation), x, y)); - contentStream.showText(watermarkText); + contentStream.showText(stampText); contentStream.endText(); } private void addImageStamp( PDPageContentStream contentStream, - MultipartFile watermarkImage, + MultipartFile stampImage, PDDocument document, PDPage page, float rotation, @@ -241,8 +241,8 @@ public class StampController { float margin) throws IOException { - // Load the watermark image - BufferedImage image = ImageIO.read(watermarkImage.getInputStream()); + // Load the stamp image + BufferedImage image = ImageIO.read(stampImage.getInputStream()); // Compute width based on original aspect ratio float aspectRatio = (float) image.getWidth() / (float) image.getHeight(); @@ -319,4 +319,4 @@ public class StampController { private float calculateTextCapHeight(PDFont font, float fontSize) { return font.getFontDescriptor().getCapHeight() / 1000 * fontSize; } -} +} \ No newline at end of file diff --git a/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java b/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java index 5465988c..850eb927 100644 --- a/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java +++ b/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java @@ -24,8 +24,9 @@ public class PDFWithPageNums extends PDFFile { "The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')\"") private String pageNumbers; + @Hidden - public List getPageNumbersList() { + public List getPageNumbersList(boolean zeroCount) { int pageCount = 0; try { pageCount = Loader.loadPDF(getFileInput().getBytes()).getNumberOfPages(); @@ -33,13 +34,13 @@ public class PDFWithPageNums extends PDFFile { // TODO Auto-generated catch block e.printStackTrace(); } - return GeneralUtils.parsePageString(pageNumbers, pageCount); + return GeneralUtils.parsePageString(pageNumbers, pageCount, zeroCount); } - + @Hidden - public List getPageNumbersList(PDDocument doc) { + public List getPageNumbersList(PDDocument doc,boolean zeroCount ) { int pageCount = 0; pageCount = doc.getNumberOfPages(); - return GeneralUtils.parsePageString(pageNumbers, pageCount); + return GeneralUtils.parsePageString(pageNumbers, pageCount, zeroCount); } } diff --git a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java index 4ef5964c..674de8b0 100644 --- a/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/GeneralUtils.java @@ -116,6 +116,9 @@ public class GeneralUtils { } public static List parsePageString(String pageOrder, int totalPages) { + return parsePageString(pageOrder, totalPages , false ); + } + public static List parsePageString(String pageOrder, int totalPages, boolean isOneBased) { if (pageOrder == null || pageOrder.isEmpty()) { return Collections.singletonList(1); } @@ -123,17 +126,23 @@ public class GeneralUtils { // Convert the single number string to an integer and return it in a list return Collections.singletonList(Integer.parseInt(pageOrder)); } - return parsePageList(pageOrder.split(","), totalPages); + return parsePageList(pageOrder.split(","), totalPages, isOneBased); } - public static List parsePageList(String[] pageOrderArr, int totalPages) { + return parsePageList(pageOrderArr, totalPages, false); + } + + + public static List parsePageList(String[] pageOrderArr, int totalPages, boolean isOneBased) { List newPageOrder = new ArrayList<>(); + int adjustmentFactor = isOneBased ? 1 : 0; + // loop through the page order array for (String element : pageOrderArr) { if ("all".equalsIgnoreCase(element)) { for (int i = 0; i < totalPages; i++) { - newPageOrder.add(i); + newPageOrder.add(i+ adjustmentFactor); } // As all pages are already added, no need to check further break; @@ -164,7 +173,7 @@ public class GeneralUtils { pageNum += constantExists ? constant : 0; if (pageNum <= totalPages && pageNum > 0) { - newPageOrder.add(pageNum - 1); + newPageOrder.add(pageNum - adjustmentFactor); } } } else if (element.contains("-")) { @@ -179,11 +188,11 @@ public class GeneralUtils { // loop through the range of pages for (int j = start; j <= end; j++) { // print the current index - newPageOrder.add(j - 1); + newPageOrder.add(j - adjustmentFactor); } } else { // if the element is a single page - newPageOrder.add(Integer.parseInt(element) - 1); + newPageOrder.add(Integer.parseInt(element) - adjustmentFactor); } } diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index aeda5c47..92ca7da4 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -11,6 +11,7 @@ imgPrompt=Select Image(s) genericSubmit=Submit processTimeWarning=Warning: This process can take up to a minute depending on file-size pageOrderPrompt=Custom Page Order (Enter a comma-separated list of page numbers or Functions like 2n+1) : +pageSelectionPrompt=Custom Page Selection (Enter a comma-separated list of page numbers 1,5,6 or Functions like 2n+1) : goToPage=Go true=True false=False diff --git a/src/main/resources/templates/misc/stamp.html b/src/main/resources/templates/misc/stamp.html index a05e9717..126c8f7e 100644 --- a/src/main/resources/templates/misc/stamp.html +++ b/src/main/resources/templates/misc/stamp.html @@ -22,6 +22,12 @@

+ +
+ + +
+
- - - + +
- + - - + +
- +

Sync browser settings with Account

Settings Comparison:

@@ -226,10 +226,10 @@ text-align: center; } - - - + + + - - - - - - + + + + + +
diff --git a/src/main/resources/templates/addUsers.html b/src/main/resources/templates/addUsers.html index d088364e..ff3eb559 100644 --- a/src/main/resources/templates/addUsers.html +++ b/src/main/resources/templates/addUsers.html @@ -12,13 +12,13 @@
- +

Admin User Control Settings

- - - + + + @@ -40,7 +40,7 @@
- +

Add New User

@@ -69,7 +69,7 @@
- + diff --git a/src/main/resources/templates/auto-split-pdf.html b/src/main/resources/templates/auto-split-pdf.html index bb984cc5..304216b9 100644 --- a/src/main/resources/templates/auto-split-pdf.html +++ b/src/main/resources/templates/auto-split-pdf.html @@ -26,7 +26,7 @@

- +

diff --git a/src/main/resources/templates/change-creds.html b/src/main/resources/templates/change-creds.html index 79d82e04..f5b86b67 100644 --- a/src/main/resources/templates/change-creds.html +++ b/src/main/resources/templates/change-creds.html @@ -33,7 +33,7 @@

User!

- +

Change Username and password

@@ -58,11 +58,11 @@
- + - - -
-
-
- -
-
- - + + + + + + + + +
+
+
+

+
+
+
+

+ +
+ + + +
+ +
+ + +
+ + +
+ + +
+
+ + +
+
+ +
+ + +
+ +

+ + + +
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-html.html b/src/main/resources/templates/convert/pdf-to-html.html index 43e71320..7360e631 100644 --- a/src/main/resources/templates/convert/pdf-to-html.html +++ b/src/main/resources/templates/convert/pdf-to-html.html @@ -1,29 +1,29 @@ - - - - - - -
-
-
-

-
-
-
-

-
-
-
- - -
-

-
-
-
-
-
-
- - + + + + + + +
+
+
+

+
+
+
+

+
+
+
+ + +
+

+
+
+
+
+
+
+ + diff --git a/src/main/resources/templates/convert/pdf-to-img.html b/src/main/resources/templates/convert/pdf-to-img.html index 57bae997..52bf2e66 100644 --- a/src/main/resources/templates/convert/pdf-to-img.html +++ b/src/main/resources/templates/convert/pdf-to-img.html @@ -1,61 +1,61 @@ - - - - - - - - -
-
-
- -

-
-
-
-

-

-
-
-
- - -
-
- - -
-
- - -
-
- - -
- -
- -
-
-
- -
-
-
- - + + + + + + + + +
+
+
+ +

+
+
+
+

+

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+
+ +
+
+
+ + diff --git a/src/main/resources/templates/convert/pdf-to-presentation.html b/src/main/resources/templates/convert/pdf-to-presentation.html index 58c28e9f..a08c202b 100644 --- a/src/main/resources/templates/convert/pdf-to-presentation.html +++ b/src/main/resources/templates/convert/pdf-to-presentation.html @@ -14,9 +14,9 @@

- +
- + - - - -
-
- - -
-

- - - - -
+ + + + + + +
+
+
+

+
+
+
+

+
+
+ +
+ + +
+
+ + +
+

+
+
+
+
+
\ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-word.html b/src/main/resources/templates/convert/pdf-to-word.html index 27d7d833..8ed0d9a8 100644 --- a/src/main/resources/templates/convert/pdf-to-word.html +++ b/src/main/resources/templates/convert/pdf-to-word.html @@ -14,9 +14,9 @@

- +
- + -
- - - -

-
- - - -
- - - + + + + + + +
+
+
+

+
+
+
+

+
+ +
+ + +
+

+
+
+
+
+
+
+ + diff --git a/src/main/resources/templates/crop.html b/src/main/resources/templates/crop.html index 47aa504b..f0d2186f 100644 --- a/src/main/resources/templates/crop.html +++ b/src/main/resources/templates/crop.html @@ -1,147 +1,147 @@ - - - - - - - -
-
-
-

-
-
-
-

-
-
- - - - - -
-
- - -
- - - -
-
-
-
-
-
- - + + + + + + + +
+
+
+

+
+
+
+

+
+
+ + + + + +
+
+ + +
+ + + +
+
+
+
+
+
+ + diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html index 4e6fc585..90e654f7 100644 --- a/src/main/resources/templates/error.html +++ b/src/main/resources/templates/error.html @@ -21,7 +21,7 @@ .button:hover { background-color: #005b7f; } - + .features-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 3fr)); @@ -40,7 +40,7 @@ .feature-card .card-text { flex: 1; } - + #support-section { background-color: #f9f9f9; padding: 4rem; @@ -94,23 +94,23 @@ margin-top: 0; transition: all 0.3s ease-in-out; } - +
- +
- +

Oops!

We can't seem to find the page you're looking for.

-

Something went wrong

- +

Something went wrong

+

Need help / Found a issue?

If you're still having trouble, don't hesitate to reach out to us for help. You can submit a ticket on our GitHub page or contact us through Discord:

@@ -124,8 +124,8 @@ margin-top: 0;
- - + + diff --git a/src/main/resources/templates/extract-page.html b/src/main/resources/templates/extract-page.html index 92e3905a..77cc7496 100644 --- a/src/main/resources/templates/extract-page.html +++ b/src/main/resources/templates/extract-page.html @@ -17,10 +17,10 @@
- +
- +
diff --git a/src/main/resources/templates/fragments/card.html b/src/main/resources/templates/fragments/card.html index c3583da6..1d8193cd 100644 --- a/src/main/resources/templates/fragments/card.html +++ b/src/main/resources/templates/fragments/card.html @@ -1,12 +1,12 @@ -
- -
- Icon -
-
-

-
-
- Favorite -
-
+
+ +
+ Icon +
+
+

+
+
+ Favorite +
+
diff --git a/src/main/resources/templates/fragments/common.html b/src/main/resources/templates/fragments/common.html index e6e2b4ef..633810ef 100644 --- a/src/main/resources/templates/fragments/common.html +++ b/src/main/resources/templates/fragments/common.html @@ -111,9 +111,9 @@ -
@@ -131,7 +131,7 @@ - + \ No newline at end of file diff --git a/src/main/resources/templates/fragments/errorBannerPerPage.html b/src/main/resources/templates/fragments/errorBannerPerPage.html index 583d057b..48bf365c 100644 --- a/src/main/resources/templates/fragments/errorBannerPerPage.html +++ b/src/main/resources/templates/fragments/errorBannerPerPage.html @@ -1,6 +1,6 @@ - +
- - + +
- +
diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 3c84d8e4..3d549ac7 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -14,7 +14,7 @@ body { padding-top: 40px; padding-bottom: 40px; background-color: #f5f5f5; - + } .form-signin { @@ -54,7 +54,7 @@ body { margin-top: auto; } body.light-mode input:-webkit-autofill, -body.light-mode input:-webkit-autofill:hover, +body.light-mode input:-webkit-autofill:hover, body.light-mode input:-webkit-autofill:focus, body.light-mode input:-webkit-autofill:active { -webkit-text-fill-color: #212529; /* Dark font color */ @@ -63,7 +63,7 @@ body.light-mode input:-webkit-autofill:active { /* Dark Mode */ body.dark-mode input:-webkit-autofill, -body.dark-mode input:-webkit-autofill:hover, +body.dark-mode input:-webkit-autofill:hover, body.dark-mode input:-webkit-autofill:focus, body.dark-mode input:-webkit-autofill:active { -webkit-text-fill-color: #f8f9fa; /* Light font color */ @@ -142,7 +142,7 @@ function setInputMode(elementId, mode) { break; case "rainbow": // Assuming you have defined some classes for rainbow mode - + break; } } @@ -151,7 +151,7 @@ function setInputMode(elementId, mode) { document.addEventListener('modeChanged', function(e) { var mode = e.detail; - + setInputMode("username", mode); setInputMode("password", mode); document.body.classList.remove("light-mode", "dark-mode", "rainbow-mode"); // remove all mode classes first @@ -167,11 +167,11 @@ document.addEventListener('modeChanged', function(e) { document.body.classList.add("rainbow-mode"); break; } - + }); document.addEventListener('DOMContentLoaded', function() { - + const defaultLocale = document.documentElement.lang || 'en_GB'; const storedLocale = localStorage.getItem('languageCode') || defaultLocale; @@ -186,7 +186,7 @@ document.addEventListener('DOMContentLoaded', function() { window.location.href = currentURL.toString(); return; } - + const dropdown = document.getElementById('languageDropdown'); const dropdownItems = document.querySelectorAll('.lang_dropdown-item'); @@ -230,7 +230,7 @@ function handleDropdownItemClick(event) { event.preventDefault(); const languageCode = event.currentTarget.dataset.bsLanguageCode; const dropdown = document.getElementById('languageDropdown'); - + if (languageCode) { localStorage.setItem('languageCode', languageCode); const currentLang = document.documentElement.getAttribute('lang'); @@ -292,22 +292,22 @@ function handleDropdownItemClick(event) { - - - + + +
Invalid username or password.
Your account has been locked.
- + - - + +
- - + + diff --git a/src/main/resources/templates/merge-pdfs.html b/src/main/resources/templates/merge-pdfs.html index 26bd3c27..6e5d2cf5 100644 --- a/src/main/resources/templates/merge-pdfs.html +++ b/src/main/resources/templates/merge-pdfs.html @@ -1,40 +1,40 @@ - - - - - - - -
-
-
-

-
-
-
-

-
-
- -
- -
-
-
    -
    -
    - - - -
    -
    - - -
    -
    -
    -
    -
    -
    - + + + + + + + +
    +
    +
    +

    +
    +
    +
    +

    +
    +
    + +
    + +
    +
    +
      +
      +
      + + + +
      +
      + + +
      +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/src/main/resources/templates/misc/add-image.html b/src/main/resources/templates/misc/add-image.html index 05d037a6..e28f7bb2 100644 --- a/src/main/resources/templates/misc/add-image.html +++ b/src/main/resources/templates/misc/add-image.html @@ -1,141 +1,141 @@ - - - - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      - - -
      - - -
      -
      -
      - -
      -
      - - -
      - - -
      - - - -
      - -
      - - -
      - -
      - -
      -
      -
      -
      -
      -
      - + + + + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      + + +
      + + +
      +
      +
      + +
      +
      + + +
      + + +
      + + + +
      + +
      + + +
      + +
      + +
      +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/src/main/resources/templates/misc/add-page-numbers.html b/src/main/resources/templates/misc/add-page-numbers.html index 7be56bcc..e484a72d 100644 --- a/src/main/resources/templates/misc/add-page-numbers.html +++ b/src/main/resources/templates/misc/add-page-numbers.html @@ -1,154 +1,154 @@ - - - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      -
      -
      -
      -
      - -
      - - - -
      - -
      -
      1
      -
      2
      -
      3
      -
      4
      -
      5
      -
      6
      -
      7
      -
      8
      -
      9
      -
      -
      - - -
      - -
      -
      - -
      -
      - -
      - -
      - -
      -
      -
      - - -
      -
      -
      - - + + + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      +
      +
      +
      +
      + +
      + + + +
      + +
      +
      1
      +
      2
      +
      3
      +
      4
      +
      5
      +
      6
      +
      7
      +
      8
      +
      9
      +
      +
      + + +
      + +
      +
      + +
      +
      + +
      + +
      + +
      +
      +
      + + +
      +
      +
      + + diff --git a/src/main/resources/templates/misc/adjust-contrast.html b/src/main/resources/templates/misc/adjust-contrast.html index 3cfdb5b9..23effdd0 100644 --- a/src/main/resources/templates/misc/adjust-contrast.html +++ b/src/main/resources/templates/misc/adjust-contrast.html @@ -1,310 +1,310 @@ - - - - - - - -
      -
      -
      -

      -
      -
      -
      -
      -
      - -
      -
      -

      -
      -
      -
      -
      - - -
      -
      - - - - - -
      -
      -
      -
      -
      -
      - - + + + + + + + +
      +
      +
      +

      +
      +
      +
      +
      +
      + +
      +
      +

      +
      +
      +
      +
      + + +
      +
      + + + + + +
      +
      +
      +
      +
      +
      + + diff --git a/src/main/resources/templates/misc/auto-rename.html b/src/main/resources/templates/misc/auto-rename.html index e998182d..0295acac 100644 --- a/src/main/resources/templates/misc/auto-rename.html +++ b/src/main/resources/templates/misc/auto-rename.html @@ -1,30 +1,30 @@ - - - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      -
      -
      -
      - -
      -
      -
      -
      - -
      -
      -
      - - + + + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      +
      +
      +
      + +
      +
      +
      +
      + +
      +
      +
      + + diff --git a/src/main/resources/templates/misc/change-metadata.html b/src/main/resources/templates/misc/change-metadata.html index 6c8780fd..6affa6bf 100644 --- a/src/main/resources/templates/misc/change-metadata.html +++ b/src/main/resources/templates/misc/change-metadata.html @@ -1,261 +1,261 @@ - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      - -
      -
      -

      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - -
      -
      - - -
      - -
      -
      -
      -
      -
      -
      - - + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      + +
      +
      +

      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + +
      +
      + + +
      + +
      +
      +
      +
      +
      +
      + + diff --git a/src/main/resources/templates/misc/compare.html b/src/main/resources/templates/misc/compare.html index f520e274..7269b032 100644 --- a/src/main/resources/templates/misc/compare.html +++ b/src/main/resources/templates/misc/compare.html @@ -1,190 +1,190 @@ - - - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      - -
      -
      - - - -
      -
      -

      -
      -
      -
      -

      -
      -
      -
      - - -
      -
      -
      -
      -
      + + + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      + +
      +
      + + + +
      +
      +

      +
      +
      +
      +

      +
      +
      +
      + + +
      +
      +
      +
      +
      \ No newline at end of file diff --git a/src/main/resources/templates/misc/compress-pdf.html b/src/main/resources/templates/misc/compress-pdf.html index 8e8c242f..c991a6c8 100644 --- a/src/main/resources/templates/misc/compress-pdf.html +++ b/src/main/resources/templates/misc/compress-pdf.html @@ -29,7 +29,7 @@
      - +

      diff --git a/src/main/resources/templates/misc/extract-images.html b/src/main/resources/templates/misc/extract-images.html index ac3c3117..e813e680 100644 --- a/src/main/resources/templates/misc/extract-images.html +++ b/src/main/resources/templates/misc/extract-images.html @@ -17,7 +17,7 @@
      - + @@ -81,10 +81,10 @@
      - - + +
      - + -
      - -
      - - -
      - - - -
      - -
      -
      1
      -
      2
      -
      3
      -
      4
      -
      5
      -
      6
      -
      7
      -
      8
      -
      9
      -
      -
      - - - - - -
      - - -
      - -
      - - -
      - - - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - - -
      - - -
      - -
      - - -
      - -
      - - -
      - - -
      - -
      -
      - - - -
      - - - + + + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      +
      +
      +
      + +
      + + +
      + +
      + + +
      + + + +
      + +
      +
      1
      +
      2
      +
      3
      +
      4
      +
      5
      +
      6
      +
      7
      +
      8
      +
      9
      +
      +
      + + + + + +
      + + +
      + +
      + + +
      + + + +
      + + +
      + +
      + + +
      + +
      + + +
      + +
      + + +
      + + +
      + + +
      + +
      + + +
      + +
      + + +
      + + +
      + +
      +
      +
      + +
      +
      +
      + + diff --git a/src/main/resources/templates/multi-page-layout.html b/src/main/resources/templates/multi-page-layout.html index 911580c9..646f7dc0 100644 --- a/src/main/resources/templates/multi-page-layout.html +++ b/src/main/resources/templates/multi-page-layout.html @@ -30,7 +30,7 @@ - + diff --git a/src/main/resources/templates/overlay-pdf.html b/src/main/resources/templates/overlay-pdf.html index 627ec9e5..cab73486 100644 --- a/src/main/resources/templates/overlay-pdf.html +++ b/src/main/resources/templates/overlay-pdf.html @@ -13,13 +13,13 @@
      - - + +

      - + + + + + + + + + + + +
      +
      + + +
      + + + + +
      +
      + + +
      + + + diff --git a/src/main/resources/templates/pipeline.html b/src/main/resources/templates/pipeline.html index 36535a9b..206ff28e 100644 --- a/src/main/resources/templates/pipeline.html +++ b/src/main/resources/templates/pipeline.html @@ -1,254 +1,254 @@ - - - - - - - - - -
      -
      -
      - -

      -
      -
      - -

      -

      -
      -
      - - - -
      - -
      -
      - -
      -
      -
      -
      -
      - - -
      -
      -
      - - -

      Below info is Alpha only, will be removed and hence not translated

      -

      Current Limitations

      -
        -
      • Cannot have more than one of the same operation
      • -
      • Cannot input additional files via UI
      • -
      • All files and operations run in serial mode
      • -
      - -

      How it Works Notes

      -
        -
      • Configure the pipeline config file and input files to run - files against it
      • -
      • For reuse, download the config file and re-upload it when - needed, or place it in /pipeline/defaultWebUIConfigs/ to - auto-load in the web UI for all users
      • -
      - -

      How to use pre-load configs in web UI

      -
        -
      • Download config files
      • -
      • For reuse, download the config file and re-upload it when - needed, or place it in /pipeline/defaultWebUIConfigs/ to - auto-load in the web UI for all users
      • -
      - -

      Todo

      -
        -
      • Save to browser/Account
      • -
      • offline folder scan mode checks and testing for unique usecases
      • -
      • Improve operation config settings UI
      • -
      - - -

      User Guide for Local Directory Scanning and File - Processing

      - -

      Setting Up Watched Folders:

      -

      Create a folder where you want your files to be monitored. - This is your 'watched folder'.

      -

      - The default directory for this is - ./pipeline/watchedFolders/ -

      -

      Place any directories you want to be scanned into this - folder, this folder should contain multiple folders each for their - own tasks and pipelines.

      - -

      Configuring Processing with JSON Files:

      -

      - In each directory you want processed (e.g - ./pipeline/watchedFolders/officePrinter - ), include a JSON configuration file. -

      -

      This JSON file should specify how you want the files in the - directory to be handled (e.g., what operations to perform on them) - which can be made, configured and downloaded from Stirling-PDF - Pipeline interface.

      - -

      Automatic Scanning and Processing:

      -

      The system automatically checks the watched folder every - minute for new directories and files to process.

      -

      When a directory with a valid JSON configuration file is - found, it begins processing the files inside as per the - configuration.

      - -

      Processing Steps:

      -

      Files in each directory are processed according to the - instructions in the JSON file.

      -

      This might involve file conversions, data filtering, - renaming files, etc. If the output of a step is a zip, this zip - will be automatically unzipped as it passes to next process.

      - -

      Results and Output:

      -

      - After processing, the results are saved in a specified output - location. This could be a different folder or location as defined - in the JSON file or the default location - ./pipeline/finishedFolders/ - . -

      -

      Each processed file is named and organized according to the - rules set in the JSON configuration.

      - -

      Completion and Cleanup:

      -

      Once processing is complete, the original files in the - watched folder's directory are removed.

      -

      You can find the processed files in the designated output - location.

      - -

      Error Handling:

      -

      If there's an error during processing, the system will not - delete the original files, allowing you to check and retry if - necessary.

      - -

      User Interaction:

      -

      As a user, your main tasks are to set up the watched - folders, place directories with files for processing, and create - the corresponding JSON configuration files.

      -

      The system handles the rest, including scanning, processing, - and outputting results.

      - - - - - - - -
      -
      -
      - -
      -
      - - + + + + + + + + + +
      +
      +
      + +

      +
      +
      + +

      +

      +
      +
      + + + +
      + +
      +
      + +
      +
      +
      +
      +
      + + +
      +
      +
      + + +

      Below info is Alpha only, will be removed and hence not translated

      +

      Current Limitations

      +
        +
      • Cannot have more than one of the same operation
      • +
      • Cannot input additional files via UI
      • +
      • All files and operations run in serial mode
      • +
      + +

      How it Works Notes

      +
        +
      • Configure the pipeline config file and input files to run + files against it
      • +
      • For reuse, download the config file and re-upload it when + needed, or place it in /pipeline/defaultWebUIConfigs/ to + auto-load in the web UI for all users
      • +
      + +

      How to use pre-load configs in web UI

      +
        +
      • Download config files
      • +
      • For reuse, download the config file and re-upload it when + needed, or place it in /pipeline/defaultWebUIConfigs/ to + auto-load in the web UI for all users
      • +
      + +

      Todo

      +
        +
      • Save to browser/Account
      • +
      • offline folder scan mode checks and testing for unique usecases
      • +
      • Improve operation config settings UI
      • +
      + + +

      User Guide for Local Directory Scanning and File + Processing

      + +

      Setting Up Watched Folders:

      +

      Create a folder where you want your files to be monitored. + This is your 'watched folder'.

      +

      + The default directory for this is + ./pipeline/watchedFolders/ +

      +

      Place any directories you want to be scanned into this + folder, this folder should contain multiple folders each for their + own tasks and pipelines.

      + +

      Configuring Processing with JSON Files:

      +

      + In each directory you want processed (e.g + ./pipeline/watchedFolders/officePrinter + ), include a JSON configuration file. +

      +

      This JSON file should specify how you want the files in the + directory to be handled (e.g., what operations to perform on them) + which can be made, configured and downloaded from Stirling-PDF + Pipeline interface.

      + +

      Automatic Scanning and Processing:

      +

      The system automatically checks the watched folder every + minute for new directories and files to process.

      +

      When a directory with a valid JSON configuration file is + found, it begins processing the files inside as per the + configuration.

      + +

      Processing Steps:

      +

      Files in each directory are processed according to the + instructions in the JSON file.

      +

      This might involve file conversions, data filtering, + renaming files, etc. If the output of a step is a zip, this zip + will be automatically unzipped as it passes to next process.

      + +

      Results and Output:

      +

      + After processing, the results are saved in a specified output + location. This could be a different folder or location as defined + in the JSON file or the default location + ./pipeline/finishedFolders/ + . +

      +

      Each processed file is named and organized according to the + rules set in the JSON configuration.

      + +

      Completion and Cleanup:

      +

      Once processing is complete, the original files in the + watched folder's directory are removed.

      +

      You can find the processed files in the designated output + location.

      + +

      Error Handling:

      +

      If there's an error during processing, the system will not + delete the original files, allowing you to check and retry if + necessary.

      + +

      User Interaction:

      +

      As a user, your main tasks are to set up the watched + folders, place directories with files for processing, and create + the corresponding JSON configuration files.

      +

      The system handles the rest, including scanning, processing, + and outputting results.

      + + + + + + + +
      +
      +
      + +
      +
      + + \ No newline at end of file diff --git a/src/main/resources/templates/remove-pages.html b/src/main/resources/templates/remove-pages.html index ff4973f2..1449fc2e 100644 --- a/src/main/resources/templates/remove-pages.html +++ b/src/main/resources/templates/remove-pages.html @@ -18,7 +18,7 @@
      - +
      diff --git a/src/main/resources/templates/rotate-pdf.html b/src/main/resources/templates/rotate-pdf.html index edde058b..7c62c0be 100644 --- a/src/main/resources/templates/rotate-pdf.html +++ b/src/main/resources/templates/rotate-pdf.html @@ -1,132 +1,132 @@ - - - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      - - -
      - - - - - -
      -
      -
      -
      -
      -
      - - - - - + + + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      + +
      +
      + + + +
      + +
      +
      +
      +
      +
      +
      + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/scale-pages.html b/src/main/resources/templates/scale-pages.html index d0727367..1165f862 100644 --- a/src/main/resources/templates/scale-pages.html +++ b/src/main/resources/templates/scale-pages.html @@ -25,7 +25,7 @@ - + @@ -34,7 +34,7 @@ - + diff --git a/src/main/resources/templates/security/add-password.html b/src/main/resources/templates/security/add-password.html index 191486fe..5c09720f 100644 --- a/src/main/resources/templates/security/add-password.html +++ b/src/main/resources/templates/security/add-password.html @@ -1,86 +1,86 @@ - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      - -
      -
      - -
      -
      -
      - - -
      -
      - - -
      - -
      - -
      -
      - -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      - -
      -
      -
      - -
      - -
      -
      -
      -
      -
      -
      -
      - - + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      + +
      +
      + +
      +
      +
      + + +
      +
      + + +
      + +
      + +
      +
      + +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      +
      +
      +
      + + diff --git a/src/main/resources/templates/security/add-watermark.html b/src/main/resources/templates/security/add-watermark.html index a34c23d0..f61dcabf 100644 --- a/src/main/resources/templates/security/add-watermark.html +++ b/src/main/resources/templates/security/add-watermark.html @@ -1,144 +1,144 @@ - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      - -
      -
      - -
      - -
      -
      - -
      - - -
      -
      - - -
      -
      - - -
      - - - -
      - - -
      -
      - - - -
      - - - - -
      - - -
      -
      - - -
      -
      - - -
      -
      - -
      -
      - - - -
      -
      -
      -
      -
      -
      - - + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      + +
      +
      + +
      + +
      +
      + +
      + + +
      +
      + + +
      +
      + + +
      + + + +
      + + +
      +
      + + + +
      + + + + +
      + + +
      +
      + + +
      +
      + + +
      +
      + +
      +
      + + + +
      +
      +
      +
      +
      +
      + + diff --git a/src/main/resources/templates/security/auto-redact.html b/src/main/resources/templates/security/auto-redact.html index 5485c4e5..791b5da0 100644 --- a/src/main/resources/templates/security/auto-redact.html +++ b/src/main/resources/templates/security/auto-redact.html @@ -15,12 +15,12 @@
      - +
      - +
      - + - + - - + +
      - +
      - +
      - +
      - + diff --git a/src/main/resources/templates/security/change-permissions.html b/src/main/resources/templates/security/change-permissions.html index 0d35b02a..cf0cd3b0 100644 --- a/src/main/resources/templates/security/change-permissions.html +++ b/src/main/resources/templates/security/change-permissions.html @@ -1,71 +1,71 @@ - - - - - - - -
      -
      -
      -

      -
      -
      -
      -

      -

      -
      -
      - -
      -
      -
      - -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      - -
      -
      -
      - -
      - -
      -
      -
      -
      -
      -
      -
      - - + + + + + + + +
      +
      +
      +

      +
      +
      +
      +

      +

      +
      +
      + +
      +
      +
      + +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      +
      + + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      +
      +
      +
      + + diff --git a/src/main/resources/templates/security/get-info-on-pdf.html b/src/main/resources/templates/security/get-info-on-pdf.html index 84bf8692..317c4e5e 100644 --- a/src/main/resources/templates/security/get-info-on-pdf.html +++ b/src/main/resources/templates/security/get-info-on-pdf.html @@ -34,13 +34,13 @@ JSON - + - +