diff --git a/Dockerfile b/Dockerfile index 3e257f1dff9..44031ba708b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,8 +45,8 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /et # CV py3-opencv \ # python3/pip - python3 && \ - wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ + python3 \ + py3-pip && \ # 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/Dockerfile-fat b/Dockerfile-fat index 94d3d73b104..c31fe348c4a 100644 --- a/Dockerfile-fat +++ b/Dockerfile-fat @@ -61,8 +61,8 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /et # CV py3-opencv \ # python3/pip - python3 && \ - wget https://bootstrap.pypa.io/get-pip.py -qO - | python3 - --break-system-packages --no-cache-dir --upgrade && \ + python3 \ + py3-pip && \ # 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/build.gradle b/build.gradle index 07abc000ea5..12780703cc6 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ ext { } group = "stirling.software" -version = "0.26.2" +version = "0.27.0" java { // 17 is lowest but we support and recommend 21 diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index 3b4ea174063..3410b950095 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -78,7 +78,8 @@ public static void main(String[] args) throws IOException, InterruptedException // custom javs settings file if (Files.exists(Paths.get("configs/custom_settings.yml"))) { - String existingLocation = propertyFiles.getOrDefault("spring.config.additional-location", ""); + String existingLocation = + propertyFiles.getOrDefault("spring.config.additional-location", ""); if (!existingLocation.isEmpty()) { existingLocation += ","; } diff --git a/src/main/java/stirling/software/SPDF/controller/api/PdfImageRemovalController.java b/src/main/java/stirling/software/SPDF/controller/api/PdfImageRemovalController.java index a3b9e93c5ad..d56b7d2d204 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/PdfImageRemovalController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/PdfImageRemovalController.java @@ -16,10 +16,9 @@ import stirling.software.SPDF.service.PdfImageRemovalService; import stirling.software.SPDF.utils.WebResponseUtils; - /** - * Controller class for handling PDF image removal requests. - * Provides an endpoint to remove images from a PDF file to reduce its size. + * Controller class for handling PDF image removal requests. Provides an endpoint to remove images + * from a PDF file to reduce its size. */ @RestController @RequestMapping("/api/v1/general") @@ -40,11 +39,12 @@ public PdfImageRemovalController(PdfImageRemovalService pdfImageRemovalService) /** * Endpoint to remove images from a PDF file. * - * This method processes the uploaded PDF file, removes all images, and returns - * the modified PDF file with a new name indicating that images were removed. + *

This method processes the uploaded PDF file, removes all images, and returns the modified + * PDF file with a new name indicating that images were removed. * * @param file The PDF file with images to be removed. - * @return ResponseEntity containing the modified PDF file as byte array with appropriate content type and filename. + * @return ResponseEntity containing the modified PDF file as byte array with appropriate + * content type and filename. * @throws IOException If an error occurs while processing the PDF file. */ @PostMapping(consumes = "multipart/form-data", value = "/remove-image-pdf") 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 7fe27a0337c..dcbc00aa250 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,8 +1,22 @@ package stirling.software.SPDF.controller.api.misc; -import io.github.pixee.security.Filenames; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.zip.Deflater; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import javax.imageio.ImageIO; + import org.apache.pdfbox.Loader; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.PDDocument; @@ -17,25 +31,14 @@ 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.PDFWithImageFormatRequest; import stirling.software.SPDF.utils.WebResponseUtils; -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.awt.image.RenderedImage; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.zip.Deflater; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - @RestController @RequestMapping("/api/v1/misc") @Tag(name = "Misc", description = "Miscellaneous APIs") diff --git a/src/main/java/stirling/software/SPDF/service/PdfImageRemovalService.java b/src/main/java/stirling/software/SPDF/service/PdfImageRemovalService.java index 052d9977756..985d1f48d4c 100644 --- a/src/main/java/stirling/software/SPDF/service/PdfImageRemovalService.java +++ b/src/main/java/stirling/software/SPDF/service/PdfImageRemovalService.java @@ -9,17 +9,15 @@ import org.apache.pdfbox.pdmodel.graphics.PDXObject; import org.springframework.stereotype.Service; -/** - * Service class responsible for removing image objects from a PDF document. - */ +/** Service class responsible for removing image objects from a PDF document. */ @Service public class PdfImageRemovalService { /** * Removes all image objects from the provided PDF document. * - * This method iterates over each page in the document and removes any - * image XObjects found in the page's resources. + * This method iterates over each page in the document and removes any image XObjects found + * in the page's resources. * * @param document The PDF document from which images will be removed. * @return The modified PDF document with images removed.