From c047a97c1343daee67448470139d5a2a769471e5 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 1 Mar 2025 20:31:29 +0000 Subject: [PATCH] Weasyprint forms #3077 (#3084) This pull request introduces a small but important change to the PDF conversion functionality. The change ensures that PDF forms are supported by adding the `--pdf-forms` option to the command lists in two methods. Changes to support PDF forms: * [`src/main/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPDF.java`](diffhunk://#diff-0e78e0f49bdd0d38127cd04656de55c2eca0b56197e098c6bfceb65e8cc3cff5R75): Added the `--pdf-forms` option to the command list in the `urlToPdf` method. * [`src/main/java/stirling/software/SPDF/utils/FileToPdf.java`](diffhunk://#diff-337516e2839031154412aa3e7c9a73402f3a630813a1946eae78f8a84e9bbe7fR56): Added the `--pdf-forms` option to the command list in the `convertHtmlToPdf` method. Closes #3077 --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --- .../SPDF/controller/api/converters/ConvertWebsiteToPDF.java | 1 + src/main/java/stirling/software/SPDF/utils/FileToPdf.java | 1 + 2 files changed, 2 insertions(+) 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 6c9f93fc..60d3bfeb 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 @@ -72,6 +72,7 @@ public class ConvertWebsiteToPDF { List command = new ArrayList<>(); command.add(runtimePathConfig.getWeasyPrintPath()); command.add(URL); + command.add("--pdf-forms"); command.add(tempOutputFile.toString()); ProcessExecutorResult returnCode = diff --git a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java index dbc0915b..b766f3de 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileToPdf.java +++ b/src/main/java/stirling/software/SPDF/utils/FileToPdf.java @@ -53,6 +53,7 @@ public class FileToPdf { command.add("-e"); command.add("utf-8"); command.add("-v"); + command.add("--pdf-forms"); command.add(tempInputFile.toString()); command.add(tempOutputFile.toString());