diff --git a/src/main/java/stirling/software/SPDF/controller/api/AnalysisController.java b/src/main/java/stirling/software/SPDF/controller/api/AnalysisController.java index 37941017e..2406e1168 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/AnalysisController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/AnalysisController.java @@ -18,17 +18,17 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; @RestController @RequestMapping("/api/v1/analysis") @Tag(name = "Analysis", description = "Analysis APIs") public class AnalysisController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public AnalysisController(CustomPDDocumentFactory pdfDocumentFactory) { + public AnalysisController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } diff --git a/src/main/java/stirling/software/SPDF/controller/api/CropController.java b/src/main/java/stirling/software/SPDF/controller/api/CropController.java index 68d252a47..68c3a44f3 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/CropController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/CropController.java @@ -21,7 +21,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.general.CropPdfForm; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class CropController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public CropController(CustomPDDocumentFactory pdfDocumentFactory) { + public CropController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -40,7 +40,8 @@ public class CropController { @Operation( summary = "Crops a PDF document", description = - "This operation takes an input PDF file and crops it according to the given coordinates. Input:PDF Output:PDF Type:SISO") + "This operation takes an input PDF file and crops it according to the given" + + " coordinates. Input:PDF Output:PDF Type:SISO") public ResponseEntity cropPdf(@ModelAttribute CropPdfForm form) throws IOException { PDDocument sourceDocument = pdfDocumentFactory.load(form); diff --git a/src/main/java/stirling/software/SPDF/controller/api/MergeController.java b/src/main/java/stirling/software/SPDF/controller/api/MergeController.java index 8c63f817e..c95aff8fe 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/MergeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/MergeController.java @@ -33,7 +33,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.general.MergePdfsRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -43,10 +43,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class MergeController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public MergeController(CustomPDDocumentFactory pdfDocumentFactory) { + public MergeController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -119,7 +119,9 @@ public class MergeController { @Operation( summary = "Merge multiple PDF files into one", description = - "This endpoint merges multiple PDF files into a single PDF file. The merged file will contain all pages from the input files in the order they were provided. Input:PDF Output:PDF Type:MISO") + "This endpoint merges multiple PDF files into a single PDF file. The merged" + + " file will contain all pages from the input files in the order they were" + + " provided. Input:PDF Output:PDF Type:MISO") public ResponseEntity mergePdfs(@ModelAttribute MergePdfsRequest form) throws IOException { List filesToDelete = new ArrayList<>(); // List of temporary files to delete 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 56d02a686..73bbe98a9 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/MultiPageLayoutController.java @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.general.MergeMultiplePagesRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -32,10 +32,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class MultiPageLayoutController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public MultiPageLayoutController(CustomPDDocumentFactory pdfDocumentFactory) { + public MultiPageLayoutController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -43,7 +43,8 @@ public class MultiPageLayoutController { @Operation( summary = "Merge multiple pages of a PDF document into a single page", description = - "This operation takes an input PDF file and the number of pages to merge into a single sheet in the output PDF file. Input:PDF Output:PDF Type:SISO") + "This operation takes an input PDF file and the number of pages to merge into a" + + " single sheet in the output PDF file. Input:PDF Output:PDF Type:SISO") public ResponseEntity mergeMultiplePagesIntoOne( @ModelAttribute MergeMultiplePagesRequest request) throws IOException { 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 fdcb55a24..fce61d3e5 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/PdfImageRemovalController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/PdfImageRemovalController.java @@ -15,7 +15,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.service.PdfImageRemovalService; import stirling.software.SPDF.utils.WebResponseUtils; @@ -31,7 +31,7 @@ public class PdfImageRemovalController { // Service for removing images from PDFs private final PdfImageRemovalService pdfImageRemovalService; - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; /** * Constructor for dependency injection of PdfImageRemovalService. @@ -41,7 +41,7 @@ public class PdfImageRemovalController { @Autowired public PdfImageRemovalController( PdfImageRemovalService pdfImageRemovalService, - CustomPDDocumentFactory pdfDocumentFactory) { + CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfImageRemovalService = pdfImageRemovalService; this.pdfDocumentFactory = pdfDocumentFactory; } @@ -61,7 +61,8 @@ public class PdfImageRemovalController { @Operation( summary = "Remove images from file to reduce the file size.", description = - "This endpoint remove images from file to reduce the file size.Input:PDF Output:PDF Type:MISO") + "This endpoint remove images from file to reduce the file size.Input:PDF" + + " Output:PDF Type:MISO") public ResponseEntity removeImages(@ModelAttribute PDFFile file) throws IOException { // Load the PDF document PDDocument document = pdfDocumentFactory.load(file); 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 7ff17ccb5..996ed45bb 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/PdfOverlayController.java @@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.general.OverlayPdfsRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -35,10 +35,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class PdfOverlayController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public PdfOverlayController(CustomPDDocumentFactory pdfDocumentFactory) { + public PdfOverlayController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -46,7 +46,8 @@ public class PdfOverlayController { @Operation( summary = "Overlay PDF files in various modes", description = - "Overlay PDF files onto a base PDF with different modes: Sequential, Interleaved, or Fixed Repeat. Input:PDF Output:PDF Type:MIMO") + "Overlay PDF files onto a base PDF with different modes: Sequential," + + " Interleaved, or Fixed Repeat. Input:PDF Output:PDF Type:MIMO") public ResponseEntity overlayPdfs(@ModelAttribute OverlayPdfsRequest request) throws IOException { MultipartFile baseFile = request.getFileInput(); 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 09f8afe9c..342d3cb8b 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RearrangePagesPDFController.java @@ -24,7 +24,7 @@ import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.SortTypes; import stirling.software.SPDF.model.api.PDFWithPageNums; import stirling.software.SPDF.model.api.general.RearrangePagesRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -34,10 +34,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class RearrangePagesPDFController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public RearrangePagesPDFController(CustomPDDocumentFactory pdfDocumentFactory) { + public RearrangePagesPDFController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -45,7 +45,9 @@ public class RearrangePagesPDFController { @Operation( summary = "Remove pages from a PDF file", description = - "This endpoint removes specified pages from a given PDF file. Users can provide a comma-separated list of page numbers or ranges to delete. Input:PDF Output:PDF Type:SISO") + "This endpoint removes specified pages from a given PDF file. Users can provide" + + " a comma-separated list of page numbers or ranges to delete. Input:PDF" + + " Output:PDF Type:SISO") public ResponseEntity deletePages(@ModelAttribute PDFWithPageNums request) throws IOException { @@ -242,7 +244,10 @@ public class RearrangePagesPDFController { @Operation( summary = "Rearrange pages in a PDF file", description = - "This endpoint rearranges pages in a given PDF file based on the specified page order or custom mode. Users can provide a page order as a comma-separated list of page numbers or page ranges, or a custom mode. Input:PDF Output:PDF") + "This endpoint rearranges pages in a given PDF file based on the specified page" + + " order or custom mode. Users can provide a page order as a" + + " comma-separated list of page numbers or page ranges, or a custom mode." + + " Input:PDF Output:PDF") public ResponseEntity rearrangePages(@ModelAttribute RearrangePagesRequest request) throws IOException { MultipartFile pdfFile = request.getFileInput(); 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 9ffc61b65..41891c7f5 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/RotationController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/RotationController.java @@ -18,7 +18,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.general.RotatePDFRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -26,10 +26,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class RotationController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public RotationController(CustomPDDocumentFactory pdfDocumentFactory) { + public RotationController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -37,7 +37,8 @@ public class RotationController { @Operation( summary = "Rotate a PDF file", description = - "This endpoint rotates a given PDF file by a specified angle. The angle must be a multiple of 90. Input:PDF Output:PDF Type:SISO") + "This endpoint rotates a given PDF file by a specified angle. The angle must be" + + " a multiple of 90. Input:PDF Output:PDF Type:SISO") public ResponseEntity rotatePDF(@ModelAttribute RotatePDFRequest request) throws IOException { MultipartFile pdfFile = request.getFileInput(); 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 5fb62cafc..48e3c0f44 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/ScalePagesController.java @@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.general.ScalePagesRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class ScalePagesController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ScalePagesController(CustomPDDocumentFactory pdfDocumentFactory) { + public ScalePagesController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -44,7 +44,8 @@ public class ScalePagesController { @Operation( summary = "Change the size of a PDF page/document", description = - "This operation takes an input PDF file and the size to scale the pages to in the output PDF file. Input:PDF Output:PDF Type:SISO") + "This operation takes an input PDF file and the size to scale the pages to in" + + " the output PDF file. Input:PDF Output:PDF Type:SISO") public ResponseEntity scalePages(@ModelAttribute ScalePagesRequest request) throws IOException { MultipartFile file = request.getFileInput(); @@ -123,7 +124,8 @@ public class ScalePagesController { } throw new IllegalArgumentException( - "Invalid PDRectangle. It must be one of the following: A0, A1, A2, A3, A4, A5, A6, LETTER, LEGAL, KEEP"); + "Invalid PDRectangle. It must be one of the following: A0, A1, A2, A3, A4, A5, A6," + + " LETTER, LEGAL, KEEP"); } private Map getSizeMap() { 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 d0df4ced5..696482b63 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPDFController.java @@ -28,7 +28,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.PDFWithPageNums; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -37,10 +37,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class SplitPDFController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public SplitPDFController(CustomPDDocumentFactory pdfDocumentFactory) { + public SplitPDFController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -48,7 +48,10 @@ public class SplitPDFController { @Operation( summary = "Split a PDF file into separate documents", description = - "This endpoint splits a given PDF file into separate documents based on the specified page numbers or ranges. Users can specify pages using individual numbers, ranges, or 'all' for every page. Input:PDF Output:PDF Type:SIMO") + "This endpoint splits a given PDF file into separate documents based on the" + + " specified page numbers or ranges. Users can specify pages using" + + " individual numbers, ranges, or 'all' for every page. Input:PDF" + + " Output:PDF Type:SIMO") public ResponseEntity splitPdf(@ModelAttribute PDFWithPageNums request) throws IOException { diff --git a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfByChaptersController.java b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfByChaptersController.java index b774d3ced..698e2b50e 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfByChaptersController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfByChaptersController.java @@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.PdfMetadata; import stirling.software.SPDF.model.api.SplitPdfByChaptersRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.service.PdfMetadataService; import stirling.software.SPDF.utils.WebResponseUtils; @@ -45,11 +45,11 @@ public class SplitPdfByChaptersController { private final PdfMetadataService pdfMetadataService; - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired public SplitPdfByChaptersController( - PdfMetadataService pdfMetadataService, CustomPDDocumentFactory pdfDocumentFactory) { + PdfMetadataService pdfMetadataService, CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfMetadataService = pdfMetadataService; this.pdfDocumentFactory = pdfDocumentFactory; } 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 2a692cbca..83f0cb0e9 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java @@ -31,7 +31,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.SplitPdfBySectionsRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -39,10 +39,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class SplitPdfBySectionsController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public SplitPdfBySectionsController(CustomPDDocumentFactory pdfDocumentFactory) { + public SplitPdfBySectionsController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -50,7 +50,9 @@ public class SplitPdfBySectionsController { @Operation( summary = "Split PDF pages into smaller sections", description = - "Split each page of a PDF into smaller sections based on the user's choice (halves, thirds, quarters, etc.), both vertically and horizontally. Input:PDF Output:ZIP-PDF Type:SISO") + "Split each page of a PDF into smaller sections based on the user's choice" + + " (halves, thirds, quarters, etc.), both vertically and horizontally." + + " Input:PDF Output:ZIP-PDF Type:SISO") public ResponseEntity splitPdf(@ModelAttribute SplitPdfBySectionsRequest request) throws Exception { List splitDocumentsBoas = new ArrayList<>(); 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 ee73cbb89..4ec2bd361 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySizeController.java @@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.general.SplitPdfBySizeOrCountRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -35,22 +35,25 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class SplitPdfBySizeController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public SplitPdfBySizeController(CustomPDDocumentFactory pdfDocumentFactory) { + public SplitPdfBySizeController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; log.info( "SplitPdfBySizeController initialized with pdfDocumentFactory: {}", - pdfDocumentFactory); + pdfDocumentFactory.getClass().getSimpleName()); } @PostMapping(value = "/split-by-size-or-count", consumes = "multipart/form-data") @Operation( summary = "Auto split PDF pages into separate documents based on size or count", description = - "split PDF into multiple paged documents based on size/count, ie if 20 pages and split into 5, it does 5 documents each 4 pages\r\n" - + " if 10MB and each page is 1MB and you enter 2MB then 5 docs each 2MB (rounded so that it accepts 1.9MB but not 2.1MB) Input:PDF Output:ZIP-PDF Type:SISO") + "split PDF into multiple paged documents based on size/count, ie if 20 pages" + + " and split into 5, it does 5 documents each 4 pages\r\n" + + " if 10MB and each page is 1MB and you enter 2MB then 5 docs each 2MB" + + " (rounded so that it accepts 1.9MB but not 2.1MB) Input:PDF" + + " Output:ZIP-PDF Type:SISO") public ResponseEntity autoSplitPdf(@ModelAttribute SplitPdfBySizeOrCountRequest request) throws Exception { diff --git a/src/main/java/stirling/software/SPDF/controller/api/ToSinglePageController.java b/src/main/java/stirling/software/SPDF/controller/api/ToSinglePageController.java index 00bdf827e..f6b0ed947 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/ToSinglePageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/ToSinglePageController.java @@ -21,7 +21,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "General", description = "General APIs") public class ToSinglePageController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ToSinglePageController(CustomPDDocumentFactory pdfDocumentFactory) { + public ToSinglePageController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -40,7 +40,10 @@ public class ToSinglePageController { @Operation( summary = "Convert a multi-page PDF into a single long page PDF", description = - "This endpoint converts a multi-page PDF document into a single paged PDF document. The width of the single page will be same as the input's width, but the height will be the sum of all the pages' heights. Input:PDF Output:PDF Type:SISO") + "This endpoint converts a multi-page PDF document into a single paged PDF" + + " document. The width of the single page will be same as the input's" + + " width, but the height will be the sum of all the pages' heights." + + " Input:PDF Output:PDF Type:SISO") public ResponseEntity pdfToSinglePage(@ModelAttribute PDFFile request) throws IOException { 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 cd68798bb..52b124e53 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 @@ -15,7 +15,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.config.RuntimePathConfig; import stirling.software.SPDF.model.ApplicationProperties; import stirling.software.SPDF.model.api.converters.HTMLToPdfRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.FileToPdf; import stirling.software.SPDF.utils.WebResponseUtils; @@ -24,7 +24,7 @@ import stirling.software.SPDF.utils.WebResponseUtils; @RequestMapping("/api/v1/convert") public class ConvertHtmlToPDF { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; private final ApplicationProperties applicationProperties; @@ -32,7 +32,7 @@ public class ConvertHtmlToPDF { @Autowired public ConvertHtmlToPDF( - CustomPDDocumentFactory pdfDocumentFactory, + CustomPDFDocumentFactory pdfDocumentFactory, ApplicationProperties applicationProperties, RuntimePathConfig runtimePathConfig) { this.pdfDocumentFactory = pdfDocumentFactory; @@ -45,7 +45,8 @@ public class ConvertHtmlToPDF { @Operation( summary = "Convert an HTML or ZIP (containing HTML and CSS) to PDF", description = - "This endpoint takes an HTML or ZIP file input and converts it to a PDF format. Input:HTML Output:PDF Type:SISO") + "This endpoint takes an HTML or ZIP file input and converts it to a PDF format." + + " Input:HTML Output:PDF Type:SISO") public ResponseEntity HtmlToPdf(@ModelAttribute HTMLToPdfRequest request) throws Exception { MultipartFile fileInput = request.getFileInput(); 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 103f6e1c8..2aa75f159 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 @@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.converters.ConvertToImageRequest; import stirling.software.SPDF.model.api.converters.ConvertToPdfRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.*; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; @@ -43,10 +43,10 @@ import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; @Tag(name = "Convert", description = "Convert APIs") public class ConvertImgPDFController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ConvertImgPDFController(CustomPDDocumentFactory pdfDocumentFactory) { + public ConvertImgPDFController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -54,7 +54,9 @@ public class ConvertImgPDFController { @Operation( summary = "Convert PDF to image(s)", description = - "This endpoint converts a PDF file to image(s) with the specified image format, color type, and DPI. Users can choose to get a single image or multiple images. Input:PDF Output:Image Type:SI-Conditional") + "This endpoint converts a PDF file to image(s) with the specified image format," + + " color type, and DPI. Users can choose to get a single image or multiple" + + " images. Input:PDF Output:Image Type:SI-Conditional") public ResponseEntity convertToImage(@ModelAttribute ConvertToImageRequest request) throws NumberFormatException, Exception { MultipartFile file = request.getFileInput(); @@ -208,7 +210,9 @@ public class ConvertImgPDFController { @Operation( summary = "Convert images to a PDF file", description = - "This endpoint converts one or more images to a PDF file. Users can specify whether to stretch the images to fit the PDF page, and whether to automatically rotate the images. Input:Image Output:PDF Type:MISO") + "This endpoint converts one or more images to a PDF file. Users can specify" + + " whether to stretch the images to fit the PDF page, and whether to" + + " automatically rotate the images. Input:Image Output:PDF Type:MISO") public ResponseEntity convertToPdf(@ModelAttribute ConvertToPdfRequest request) throws IOException { MultipartFile[] file = request.getFileInput(); 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 121539778..547d9c646 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 @@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.config.RuntimePathConfig; import stirling.software.SPDF.model.ApplicationProperties; import stirling.software.SPDF.model.api.GeneralFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.FileToPdf; import stirling.software.SPDF.utils.WebResponseUtils; @@ -34,14 +34,14 @@ import stirling.software.SPDF.utils.WebResponseUtils; @RequestMapping("/api/v1/convert") public class ConvertMarkdownToPdf { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; private final ApplicationProperties applicationProperties; private final RuntimePathConfig runtimePathConfig; @Autowired public ConvertMarkdownToPdf( - CustomPDDocumentFactory pdfDocumentFactory, + CustomPDFDocumentFactory pdfDocumentFactory, ApplicationProperties applicationProperties, RuntimePathConfig runtimePathConfig) { this.pdfDocumentFactory = pdfDocumentFactory; @@ -54,7 +54,8 @@ public class ConvertMarkdownToPdf { @Operation( summary = "Convert a Markdown file to PDF", description = - "This endpoint takes a Markdown file input, converts it to HTML, and then to PDF format. Input:MARKDOWN Output:PDF Type:SISO") + "This endpoint takes a Markdown file input, converts it to HTML, and then to" + + " PDF format. Input:MARKDOWN Output:PDF Type:SISO") public ResponseEntity markdownToPdf(@ModelAttribute GeneralFile request) throws Exception { MultipartFile fileInput = request.getFileInput(); 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 4cdfd1bdf..46bf4c033 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 @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.config.RuntimePathConfig; import stirling.software.SPDF.model.api.GeneralFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.ProcessExecutor; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; import stirling.software.SPDF.utils.WebResponseUtils; @@ -34,12 +34,12 @@ import stirling.software.SPDF.utils.WebResponseUtils; @RequestMapping("/api/v1/convert") public class ConvertOfficeController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; private final RuntimePathConfig runtimePathConfig; @Autowired public ConvertOfficeController( - CustomPDDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) { + CustomPDFDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) { this.pdfDocumentFactory = pdfDocumentFactory; this.runtimePathConfig = runtimePathConfig; } @@ -93,7 +93,8 @@ public class ConvertOfficeController { @Operation( summary = "Convert a file to a PDF using LibreOffice", description = - "This endpoint converts a given file to a PDF using LibreOffice API Input:ANY Output:PDF Type:SISO") + "This endpoint converts a given file to a PDF using LibreOffice API Input:ANY" + + " Output:PDF Type:SISO") public ResponseEntity processFileToPDF(@ModelAttribute GeneralFile request) throws Exception { MultipartFile inputFile = request.getFileInput(); 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 39c808096..f603aa277 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 @@ -21,7 +21,7 @@ import stirling.software.SPDF.model.api.PDFFile; 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.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.PDFToFile; import stirling.software.SPDF.utils.WebResponseUtils; @@ -30,10 +30,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Convert", description = "Convert APIs") public class ConvertPDFToOffice { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ConvertPDFToOffice(CustomPDDocumentFactory pdfDocumentFactory) { + public ConvertPDFToOffice(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -41,7 +41,8 @@ public class ConvertPDFToOffice { @Operation( summary = "Convert PDF to Presentation format", description = - "This endpoint converts a given PDF file to a Presentation format. Input:PDF Output:PPT Type:SISO") + "This endpoint converts a given PDF file to a Presentation format. Input:PDF" + + " Output:PPT Type:SISO") public ResponseEntity processPdfToPresentation( @ModelAttribute PdfToPresentationRequest request) throws IOException, InterruptedException { @@ -55,7 +56,8 @@ public class ConvertPDFToOffice { @Operation( summary = "Convert PDF to Text or RTF format", description = - "This endpoint converts a given PDF file to Text or RTF format. Input:PDF Output:TXT Type:SISO") + "This endpoint converts a given PDF file to Text or RTF format. Input:PDF" + + " Output:TXT Type:SISO") public ResponseEntity processPdfToRTForTXT( @ModelAttribute PdfToTextOrRTFRequest request) throws IOException, InterruptedException { @@ -82,7 +84,8 @@ public class ConvertPDFToOffice { @Operation( summary = "Convert PDF to Word document", description = - "This endpoint converts a given PDF file to a Word document format. Input:PDF Output:WORD Type:SISO") + "This endpoint converts a given PDF file to a Word document format. Input:PDF" + + " Output:WORD Type:SISO") public ResponseEntity processPdfToWord(@ModelAttribute PdfToWordRequest request) throws IOException, InterruptedException { MultipartFile inputFile = request.getFileInput(); @@ -95,7 +98,8 @@ public class ConvertPDFToOffice { @Operation( summary = "Convert PDF to XML", description = - "This endpoint converts a PDF file to an XML file. Input:PDF Output:XML Type:SISO") + "This endpoint converts a PDF file to an XML file. Input:PDF Output:XML" + + " Type:SISO") public ResponseEntity processPdfToXML(@ModelAttribute PDFFile request) throws Exception { MultipartFile inputFile = request.getFileInput(); 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 ebf9321aa..b762c0881 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 @@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.config.RuntimePathConfig; import stirling.software.SPDF.model.api.converters.UrlToPdfRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.ProcessExecutor; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; @@ -33,12 +33,12 @@ import stirling.software.SPDF.utils.WebResponseUtils; @RequestMapping("/api/v1/convert") public class ConvertWebsiteToPDF { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; private final RuntimePathConfig runtimePathConfig; @Autowired public ConvertWebsiteToPDF( - CustomPDDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) { + CustomPDFDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) { this.pdfDocumentFactory = pdfDocumentFactory; this.runtimePathConfig = runtimePathConfig; } @@ -47,7 +47,8 @@ public class ConvertWebsiteToPDF { @Operation( summary = "Convert a URL to a PDF", description = - "This endpoint fetches content from a URL and converts it to a PDF format. Input:N/A Output:PDF Type:SISO") + "This endpoint fetches content from a URL and converts it to a PDF format." + + " Input:N/A Output:PDF Type:SISO") public ResponseEntity urlToPdf(@ModelAttribute UrlToPdfRequest request) throws IOException, InterruptedException { String URL = request.getUrlInput(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/converters/ExtractCSVController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ExtractCSVController.java index 359d353d7..06cc45094 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ExtractCSVController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ExtractCSVController.java @@ -30,7 +30,7 @@ import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.PDFWithPageNums; import stirling.software.SPDF.pdf.FlexibleCSVWriter; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import technology.tabula.ObjectExtractor; import technology.tabula.Page; @@ -43,10 +43,10 @@ import technology.tabula.extractors.SpreadsheetExtractionAlgorithm; @Slf4j public class ExtractCSVController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ExtractCSVController(CustomPDDocumentFactory pdfDocumentFactory) { + public ExtractCSVController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -54,7 +54,8 @@ public class ExtractCSVController { @Operation( summary = "Extracts a CSV document from a PDF", description = - "This operation takes an input PDF file and returns CSV file of whole page. Input:PDF Output:CSV Type:SISO") + "This operation takes an input PDF file and returns CSV file of whole page." + + " Input:PDF Output:CSV Type:SISO") public ResponseEntity pdfToCsv(@ModelAttribute PDFWithPageNums form) throws Exception { String baseName = getBaseName(form.getFileInput().getOriginalFilename()); List csvEntries = new ArrayList<>(); 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 66ac4cb8b..006598bd1 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 @@ -23,7 +23,7 @@ import stirling.software.SPDF.model.api.filter.ContainsTextRequest; import stirling.software.SPDF.model.api.filter.FileSizeRequest; import stirling.software.SPDF.model.api.filter.PageRotationRequest; import stirling.software.SPDF.model.api.filter.PageSizeRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.PdfUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -32,10 +32,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Filter", description = "Filter APIs") public class FilterController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public FilterController(CustomPDDocumentFactory pdfDocumentFactory) { + public FilterController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } 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 d3d2e91cc..1d71d94b7 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 @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.ExtractHeaderRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -35,10 +35,10 @@ public class AutoRenameController { private static final float TITLE_FONT_SIZE_THRESHOLD = 20.0f; private static final int LINE_LIMIT = 200; - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public AutoRenameController(CustomPDDocumentFactory pdfDocumentFactory) { + public AutoRenameController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -46,7 +46,8 @@ public class AutoRenameController { @Operation( summary = "Extract header from PDF file", description = - "This endpoint accepts a PDF file and attempts to extract its title or header based on heuristics. Input:PDF Output:PDF Type:SISO") + "This endpoint accepts a PDF file and attempts to extract its title or header" + + " based on heuristics. Input:PDF Output:PDF Type:SISO") public ResponseEntity extractHeader(@ModelAttribute ExtractHeaderRequest request) throws Exception { MultipartFile file = request.getFileInput(); 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 16b021144..7a5c730fe 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 @@ -35,7 +35,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.AutoSplitPdfRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -51,10 +51,10 @@ public class AutoSplitPdfController { "https://github.com/Frooodle/Stirling-PDF", "https://stirlingpdf.com")); - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public AutoSplitPdfController(CustomPDDocumentFactory pdfDocumentFactory) { + public AutoSplitPdfController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } 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 0195382ea..c50c0a685 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 @@ -30,7 +30,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.RemoveBlankPagesRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.PdfUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -40,10 +40,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class BlankPageController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public BlankPageController(CustomPDDocumentFactory pdfDocumentFactory) { + public BlankPageController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -77,7 +77,9 @@ public class BlankPageController { @Operation( summary = "Remove blank pages from a PDF file", description = - "This endpoint removes blank pages from a given PDF file. Users can specify the threshold and white percentage to tune the detection of blank pages. Input:PDF Output:PDF Type:SISO") + "This endpoint removes blank pages from a given PDF file. Users can specify the" + + " threshold and white percentage to tune the detection of blank pages." + + " Input:PDF Output:PDF Type:SISO") public ResponseEntity removeBlankPages(@ModelAttribute RemoveBlankPagesRequest request) throws IOException, InterruptedException { MultipartFile inputFile = request.getFileInput(); 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 deb4e7aa0..54897f7c1 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 @@ -39,7 +39,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.OptimizePdfRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.ProcessExecutor; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; @@ -51,10 +51,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class CompressController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public CompressController(CustomPDDocumentFactory pdfDocumentFactory) { + public CompressController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -63,7 +63,8 @@ public class CompressController { byte[] fileBytes = Files.readAllBytes(pdfFile); long originalFileSize = fileBytes.length; log.info( - "Starting image compression with scale factor: {} and JPEG quality: {} on file size: {}", + "Starting image compression with scale factor: {} and JPEG quality: {} on file" + + " size: {}", scaleFactor, jpegQuality, GeneralUtils.formatBytes(originalFileSize)); @@ -140,7 +141,8 @@ public class CompressController { // More aggressive for very large images adjustedScaleFactor = Math.min(scaleFactor, 0.75); log.info( - "Page {}, Image {}: Very large image, using more aggressive scale: {}", + "Page {}, Image {}: Very large image, using more aggressive scale:" + + " {}", pageNum + 1, imageName, adjustedScaleFactor); @@ -288,7 +290,8 @@ public class CompressController { if (imageBytes.length >= originalEncodedSize) { log.info( - "Page {}, Image {}: Compressed size {} not smaller than original {}, skipping replacement", + "Page {}, Image {}: Compressed size {} not smaller than original" + + " {}, skipping replacement", pageNum + 1, imageName, GeneralUtils.formatBytes(imageBytes.length), @@ -382,7 +385,8 @@ public class CompressController { @Operation( summary = "Optimize PDF file", description = - "This endpoint accepts a PDF file and optimizes it based on the provided parameters. Input:PDF Output:PDF Type:SISO") + "This endpoint accepts a PDF file and optimizes it based on the provided" + + " parameters. Input:PDF Output:PDF Type:SISO") public ResponseEntity optimizePdf(@ModelAttribute OptimizePdfRequest request) throws Exception { MultipartFile inputFile = request.getFileInput(); @@ -493,7 +497,8 @@ public class CompressController { if (newOptimizeLevel == optimizeLevel) { if (autoMode) { log.info( - "Maximum optimization level reached without meeting target size."); + "Maximum optimization level reached without meeting target" + + " size."); sizeMet = true; } } else { @@ -512,7 +517,8 @@ public class CompressController { // Check if optimized file is larger than the original if (pdfBytes.length > inputFileSize) { log.warn( - "Optimized file is larger than the original. Returning the original file instead."); + "Optimized file is larger than the original. Returning the original file" + + " instead."); finalFile = tempInputFile; } diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/DecompressPdfController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/DecompressPdfController.java index 45767fc82..090b2b2e1 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/DecompressPdfController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/DecompressPdfController.java @@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -34,10 +34,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class DecompressPdfController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public DecompressPdfController(CustomPDDocumentFactory pdfDocumentFactory) { + public DecompressPdfController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } 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 7c4d9137f..fb27bf75a 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 @@ -32,7 +32,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.ExtractImageScansRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.CheckProgramInstall; import stirling.software.SPDF.utils.ProcessExecutor; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; @@ -46,10 +46,10 @@ public class ExtractImageScansController { private static final String REPLACEFIRST = "[.][^.]+$"; - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ExtractImageScansController(CustomPDDocumentFactory pdfDocumentFactory) { + public ExtractImageScansController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -57,7 +57,10 @@ public class ExtractImageScansController { @Operation( summary = "Extract image scans from an input file", description = - "This endpoint extracts image scans from a given file based on certain parameters. Users can specify angle threshold, tolerance, minimum area, minimum contour area, and border size. Input:PDF Output:IMAGE/ZIP Type:SIMO") + "This endpoint extracts image scans from a given file based on certain" + + " parameters. Users can specify angle threshold, tolerance, minimum area," + + " minimum contour area, and border size. Input:PDF Output:IMAGE/ZIP" + + " Type:SIMO") public ResponseEntity extractImageScans( @RequestBody( description = "Form data containing file and extraction parameters", 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 3010c1be6..af865f8f4 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 @@ -40,7 +40,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.PDFExtractImagesRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.ImageProcessingUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -50,10 +50,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class ExtractImagesController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ExtractImagesController(CustomPDDocumentFactory pdfDocumentFactory) { + public ExtractImagesController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -61,7 +61,9 @@ public class ExtractImagesController { @Operation( summary = "Extract images from a PDF file", description = - "This endpoint extracts images from a given PDF file and returns them in a zip file. Users can specify the output image format. Input:PDF Output:IMAGE/ZIP Type:SIMO") + "This endpoint extracts images from a given PDF file and returns them in a zip" + + " file. Users can specify the output image format. Input:PDF" + + " Output:IMAGE/ZIP Type:SIMO") public ResponseEntity extractImages(@ModelAttribute PDFExtractImagesRequest request) throws IOException, InterruptedException, ExecutionException { MultipartFile file = request.getFileInput(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java b/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java index 39991a1f6..8ddfa1657 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java @@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.FlattenRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -35,10 +35,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class FlattenController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public FlattenController(CustomPDDocumentFactory pdfDocumentFactory) { + public FlattenController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -46,7 +46,8 @@ public class FlattenController { @Operation( summary = "Flatten PDF form fields or full page", description = - "Flattening just PDF form fields or converting each page to images to make text unselectable. Input:PDF, Output:PDF. Type:SISO") + "Flattening just PDF form fields or converting each page to images to make text" + + " unselectable. Input:PDF, Output:PDF. Type:SISO") public ResponseEntity flatten(@ModelAttribute FlattenRequest request) throws Exception { MultipartFile file = request.getFileInput(); 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 66c1c8b66..4bca4988a 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 @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.MetadataRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; import stirling.software.SPDF.utils.propertyeditor.StringToMapPropertyEditor; @@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.propertyeditor.StringToMapPropertyEditor; @Tag(name = "Misc", description = "Miscellaneous APIs") public class MetadataController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public MetadataController(CustomPDDocumentFactory pdfDocumentFactory) { + public MetadataController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -59,7 +59,9 @@ public class MetadataController { @Operation( summary = "Update metadata of a PDF file", description = - "This endpoint allows you to update the metadata of a given PDF file. You can add, modify, or delete standard and custom metadata fields. Input:PDF Output:PDF Type:SISO") + "This endpoint allows you to update the metadata of a given PDF file. You can" + + " add, modify, or delete standard and custom metadata fields. Input:PDF" + + " Output:PDF Type:SISO") public ResponseEntity metadata(@ModelAttribute MetadataRequest request) throws IOException { 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 44fbb65b5..47d6d5b35 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 @@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.ApplicationProperties; import stirling.software.SPDF.model.api.misc.ProcessPdfWithOcrRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; @RestController @RequestMapping("/api/v1/misc") @@ -43,11 +43,11 @@ public class OCRController { private final ApplicationProperties applicationProperties; - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; public OCRController( ApplicationProperties applicationProperties, - CustomPDDocumentFactory pdfDocumentFactory) { + CustomPDFDocumentFactory pdfDocumentFactory) { this.applicationProperties = applicationProperties; this.pdfDocumentFactory = pdfDocumentFactory; } @@ -70,7 +70,9 @@ public class OCRController { @Operation( summary = "Process PDF files with OCR using Tesseract", description = - "Takes a PDF file as input, performs OCR using specified languages and OCR type (skip-text/force-ocr), and returns the processed PDF. Input:PDF Output:PDF Type:SISO") + "Takes a PDF file as input, performs OCR using specified languages and OCR type" + + " (skip-text/force-ocr), and returns the processed PDF. Input:PDF" + + " Output:PDF Type:SISO") public ResponseEntity processPdfWithOCR( @ModelAttribute ProcessPdfWithOcrRequest request) throws IOException, InterruptedException { 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 2814149e8..a953586fb 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 @@ -18,7 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.misc.OverlayImageRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.PdfUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -28,10 +28,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class OverlayImageController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public OverlayImageController(CustomPDDocumentFactory pdfDocumentFactory) { + public OverlayImageController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -39,7 +39,9 @@ public class OverlayImageController { @Operation( summary = "Overlay image onto a PDF file", description = - "This endpoint overlays an image onto a PDF file at the specified coordinates. The image can be overlaid on every page of the PDF if specified. Input:PDF/IMAGE Output:PDF Type:SISO") + "This endpoint overlays an image onto a PDF file at the specified coordinates." + + " The image can be overlaid on every page of the PDF if specified. " + + " Input:PDF/IMAGE Output:PDF Type:SISO") public ResponseEntity overlayImage(@ModelAttribute OverlayImageRequest request) { MultipartFile pdfFile = request.getFileInput(); MultipartFile imageFile = request.getImageFile(); 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 17d1bbaa9..c66b55d73 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 @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.misc.AddPageNumbersRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class PageNumbersController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public PageNumbersController(CustomPDDocumentFactory pdfDocumentFactory) { + public PageNumbersController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -44,7 +44,8 @@ public class PageNumbersController { @Operation( summary = "Add page numbers to a PDF document", description = - "This operation takes an input PDF file and adds page numbers to it. Input:PDF Output:PDF Type:SISO") + "This operation takes an input PDF file and adds page numbers to it. Input:PDF" + + " Output:PDF Type:SISO") public ResponseEntity addPageNumbers(@ModelAttribute AddPageNumbersRequest request) throws IOException { 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 374d0c53b..e75a2e20d 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 @@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.ProcessExecutor; import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; import stirling.software.SPDF.utils.WebResponseUtils; @@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class RepairController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public RepairController(CustomPDDocumentFactory pdfDocumentFactory) { + public RepairController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -40,7 +40,9 @@ public class RepairController { @Operation( summary = "Repair a PDF file", description = - "This endpoint repairs a given PDF file by running qpdf command. The PDF is first saved to a temporary location, repaired, read back, and then returned as a response. Input:PDF Output:PDF Type:SISO") + "This endpoint repairs a given PDF file by running qpdf command. The PDF is" + + " first saved to a temporary location, repaired, read back, and then" + + " returned as a response. Input:PDF Output:PDF Type:SISO") public ResponseEntity repairPdf(@ModelAttribute PDFFile request) throws IOException, InterruptedException { MultipartFile inputFile = request.getFileInput(); 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 e38657cfe..ca5370b32 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 @@ -20,7 +20,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -28,10 +28,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class ShowJavascript { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public ShowJavascript(CustomPDDocumentFactory pdfDocumentFactory) { + public ShowJavascript(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } 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 30a7540ee..e23635b82 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 @@ -38,7 +38,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.misc.AddStampRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -46,10 +46,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Misc", description = "Miscellaneous APIs") public class StampController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public StampController(CustomPDDocumentFactory pdfDocumentFactory) { + public StampController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -57,7 +57,9 @@ 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 stamp 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(); 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 cad762062..4a8981142 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 @@ -68,7 +68,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.security.SignPDFWithCertRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -81,15 +81,15 @@ public class CertSignController { Security.addProvider(new BouncyCastleProvider()); } - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public CertSignController(CustomPDDocumentFactory pdfDocumentFactory) { + public CertSignController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } private static void sign( - CustomPDDocumentFactory pdfDocumentFactory, + CustomPDFDocumentFactory pdfDocumentFactory, MultipartFile input, OutputStream output, CreateSignature instance, diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/GetInfoOnPDF.java b/src/main/java/stirling/software/SPDF/controller/api/security/GetInfoOnPDF.java index 026fd38a0..3452c3625 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/GetInfoOnPDF.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/GetInfoOnPDF.java @@ -62,7 +62,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -73,10 +73,10 @@ public class GetInfoOnPDF { static ObjectMapper objectMapper = new ObjectMapper(); - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public GetInfoOnPDF(CustomPDDocumentFactory pdfDocumentFactory) { + public GetInfoOnPDF(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } 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 6a89a0710..386e938b9 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 @@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.security.AddPasswordRequest; import stirling.software.SPDF.model.api.security.PDFPasswordRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -27,10 +27,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Security", description = "Security APIs") public class PasswordController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public PasswordController(CustomPDDocumentFactory pdfDocumentFactory) { + public PasswordController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -38,8 +38,8 @@ public class PasswordController { @Operation( summary = "Remove password from a PDF file", description = - "This endpoint removes the password from a protected PDF file. Users need to provide the" - + " existing password. Input:PDF Output:PDF Type:SISO") + "This endpoint removes the password from a protected PDF file. Users need to" + + " provide the existing password. Input:PDF Output:PDF Type:SISO") public ResponseEntity removePassword(@ModelAttribute PDFPasswordRequest request) throws IOException { MultipartFile fileInput = request.getFileInput(); @@ -57,8 +57,9 @@ public class PasswordController { @Operation( summary = "Add password to a PDF file", description = - "This endpoint adds password protection to a PDF file. Users can specify a set of" - + " permissions that should be applied to the file. Input:PDF Output:PDF") + "This endpoint adds password protection to a PDF file. Users can specify a set" + + " of permissions that should be applied to the file. Input:PDF" + + " Output:PDF") public ResponseEntity addPassword(@ModelAttribute AddPasswordRequest request) throws IOException { MultipartFile fileInput = request.getFileInput(); 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 5bffe68e1..deec98e4e 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 @@ -35,7 +35,7 @@ import stirling.software.SPDF.model.api.security.ManualRedactPdfRequest; import stirling.software.SPDF.model.api.security.RedactPdfRequest; import stirling.software.SPDF.model.api.security.RedactionArea; import stirling.software.SPDF.pdf.TextFinder; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.GeneralUtils; import stirling.software.SPDF.utils.PdfUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -47,10 +47,10 @@ import stirling.software.SPDF.utils.propertyeditor.StringToArrayListPropertyEdit @Tag(name = "Security", description = "Security APIs") public class RedactController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public RedactController(CustomPDDocumentFactory pdfDocumentFactory) { + public RedactController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -64,7 +64,9 @@ public class RedactController { @Operation( summary = "Redacts areas and pages in a PDF document", description = - "This operation takes an input PDF file with a list of areas, page number(s)/range(s)/function(s) to redact. Input:PDF, Output:PDF, Type:SISO") + "This operation takes an input PDF file with a list of areas, page" + + " number(s)/range(s)/function(s) to redact. Input:PDF, Output:PDF," + + " Type:SISO") public ResponseEntity redactPDF(@ModelAttribute ManualRedactPdfRequest request) throws IOException { MultipartFile file = request.getFileInput(); @@ -196,8 +198,8 @@ public class RedactController { @Operation( summary = "Redacts listOfText in a PDF document", description = - "This operation takes an input PDF file and redacts the provided listOfText. Input:PDF," - + " Output:PDF, Type:SISO") + "This operation takes an input PDF file and redacts the provided listOfText." + + " Input:PDF, Output:PDF, Type:SISO") public ResponseEntity redactPdf(@ModelAttribute RedactPdfRequest request) throws Exception { MultipartFile file = request.getFileInput(); diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/RemoveCertSignController.java b/src/main/java/stirling/software/SPDF/controller/api/security/RemoveCertSignController.java index 88ed9b13f..81c0bcfb1 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/RemoveCertSignController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/RemoveCertSignController.java @@ -21,7 +21,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.PDFFile; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Security", description = "Security APIs") public class RemoveCertSignController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public RemoveCertSignController(CustomPDDocumentFactory pdfDocumentFactory) { + public RemoveCertSignController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -40,7 +40,8 @@ public class RemoveCertSignController { @Operation( summary = "Remove digital signature from PDF", description = - "This endpoint accepts a PDF file and returns the PDF file without the digital signature. Input:PDF, Output:PDF Type:SISO") + "This endpoint accepts a PDF file and returns the PDF file without the digital" + + " signature. Input:PDF, Output:PDF Type:SISO") public ResponseEntity removeCertSignPDF(@ModelAttribute PDFFile request) throws Exception { MultipartFile pdf = request.getFileInput(); 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 e075559e6..e1959fc88 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 @@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.security.SanitizePdfRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.WebResponseUtils; @RestController @@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Security", description = "Security APIs") public class SanitizeController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public SanitizeController(CustomPDDocumentFactory pdfDocumentFactory) { + public SanitizeController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/ValidateSignatureController.java b/src/main/java/stirling/software/SPDF/controller/api/security/ValidateSignatureController.java index 317c6424b..4b4da4bdd 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/ValidateSignatureController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/ValidateSignatureController.java @@ -35,19 +35,19 @@ import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.security.SignatureValidationRequest; import stirling.software.SPDF.model.api.security.SignatureValidationResult; import stirling.software.SPDF.service.CertificateValidationService; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; @RestController @RequestMapping("/api/v1/security") @Tag(name = "Security", description = "Security APIs") public class ValidateSignatureController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; private final CertificateValidationService certValidationService; @Autowired public ValidateSignatureController( - CustomPDDocumentFactory pdfDocumentFactory, + CustomPDFDocumentFactory pdfDocumentFactory, CertificateValidationService certValidationService) { this.pdfDocumentFactory = pdfDocumentFactory; this.certValidationService = certValidationService; @@ -56,7 +56,8 @@ public class ValidateSignatureController { @Operation( summary = "Validate PDF Digital Signature", description = - "Validates the digital signatures in a PDF file against default or custom certificates. Input:PDF Output:JSON Type:SISO") + "Validates the digital signatures in a PDF file against default or custom" + + " certificates. Input:PDF Output:JSON Type:SISO") @PostMapping(value = "/validate-signature") public ResponseEntity> validateSignature( @ModelAttribute SignatureValidationRequest request) throws IOException { 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 3e1be8153..7ed8a5a04 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 @@ -36,7 +36,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import stirling.software.SPDF.model.api.security.AddWatermarkRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import stirling.software.SPDF.utils.PdfUtils; import stirling.software.SPDF.utils.WebResponseUtils; @@ -45,10 +45,10 @@ import stirling.software.SPDF.utils.WebResponseUtils; @Tag(name = "Security", description = "Security APIs") public class WatermarkController { - private final CustomPDDocumentFactory pdfDocumentFactory; + private final CustomPDFDocumentFactory pdfDocumentFactory; @Autowired - public WatermarkController(CustomPDDocumentFactory pdfDocumentFactory) { + public WatermarkController(CustomPDFDocumentFactory pdfDocumentFactory) { this.pdfDocumentFactory = pdfDocumentFactory; } @@ -56,7 +56,9 @@ public class WatermarkController { @Operation( summary = "Add watermark to a PDF file", description = - "This endpoint adds a watermark 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 watermark 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") public ResponseEntity addWatermark(@ModelAttribute AddWatermarkRequest request) throws IOException, Exception { MultipartFile pdfFile = request.getFileInput(); diff --git a/src/main/java/stirling/software/SPDF/service/CustomPDDocumentFactory.java b/src/main/java/stirling/software/SPDF/service/CustomPDFDocumentFactory.java similarity index 98% rename from src/main/java/stirling/software/SPDF/service/CustomPDDocumentFactory.java rename to src/main/java/stirling/software/SPDF/service/CustomPDFDocumentFactory.java index 6963b522c..5aa6ee335 100644 --- a/src/main/java/stirling/software/SPDF/service/CustomPDDocumentFactory.java +++ b/src/main/java/stirling/software/SPDF/service/CustomPDFDocumentFactory.java @@ -29,7 +29,7 @@ import stirling.software.SPDF.model.api.PDFFile; */ @Component @Slf4j -public class CustomPDDocumentFactory { +public class CustomPDFDocumentFactory { private final PdfMetadataService pdfMetadataService; @@ -63,7 +63,7 @@ public class CustomPDDocumentFactory { // Counter for tracking temporary resources private static final AtomicLong tempCounter = new AtomicLong(0); - public CustomPDDocumentFactory(PdfMetadataService pdfMetadataService) { + public CustomPDFDocumentFactory(PdfMetadataService pdfMetadataService) { this.pdfMetadataService = pdfMetadataService; } @@ -168,8 +168,8 @@ public class CustomPDDocumentFactory { private PDDocument loadAdaptively(Object source, long contentSize) throws IOException { // Get the appropriate caching strategy StreamCacheCreateFunction cacheFunction = getStreamCacheFunction(contentSize); - - //If small handle as bytes and remove original file + + // If small handle as bytes and remove original file if (contentSize <= SMALL_FILE_THRESHOLD && source instanceof File file) { source = Files.readAllBytes(file.toPath()); file.delete(); @@ -192,7 +192,7 @@ public class CustomPDDocumentFactory { throws IOException { // Get the appropriate caching strategy StreamCacheCreateFunction cacheFunction = getStreamCacheFunction(contentSize); - //If small handle as bytes and remove original file + // If small handle as bytes and remove original file if (contentSize <= SMALL_FILE_THRESHOLD && source instanceof File file) { source = Files.readAllBytes(file.toPath()); file.delete(); diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index ad404660e..14c5c09d7 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -35,7 +35,7 @@ import io.github.pixee.security.Filenames; import lombok.extern.slf4j.Slf4j; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; @Slf4j public class PdfUtils { @@ -127,7 +127,7 @@ public class PdfUtils { } public static byte[] convertFromPdf( - CustomPDDocumentFactory pdfDocumentFactory, + CustomPDFDocumentFactory pdfDocumentFactory, byte[] inputStream, String imageType, ImageType colorType, @@ -315,7 +315,7 @@ public class PdfUtils { String fitOption, boolean autoRotate, String colorType, - CustomPDDocumentFactory pdfDocumentFactory) + CustomPDFDocumentFactory pdfDocumentFactory) throws IOException { try (PDDocument doc = pdfDocumentFactory.createNewDocument()) { for (MultipartFile file : files) { @@ -405,7 +405,7 @@ public class PdfUtils { } public static byte[] overlayImage( - CustomPDDocumentFactory pdfDocumentFactory, + CustomPDFDocumentFactory pdfDocumentFactory, byte[] pdfBytes, byte[] imageBytes, float x, diff --git a/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java b/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java index 6c6852866..2270d68f0 100644 --- a/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java +++ b/src/test/java/stirling/software/SPDF/controller/api/RearrangePagesPDFControllerTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.*; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import java.util.Arrays; import java.util.List; @@ -23,8 +23,7 @@ import org.junit.jupiter.api.BeforeEach; class RearrangePagesPDFControllerTest { - @Mock - private CustomPDDocumentFactory mockPdfDocumentFactory; + @Mock private CustomPDFDocumentFactory mockPdfDocumentFactory; private RearrangePagesPDFController sut; @@ -81,21 +80,24 @@ class RearrangePagesPDFControllerTest { */ @ParameterizedTest @CsvSource({ - "1, '0'", - "2, '0,1'", - "3, '0,2,1'", - "4, '0,2,1,3'", - "5, '0,3,1,4,2'", - "6, '0,3,1,4,2,5'", - "10, '0,5,1,6,2,7,3,8,4,9'", - "50, '0,25,1,26,2,27,3,28,4,29,5,30,6,31,7,32,8,33,9,34,10,35," + - "11,36,12,37,13,38,14,39,15,40,16,41,17,42,18,43,19,44,20,45,21,46," + - "22,47,23,48,24,49'" + "1, '0'", + "2, '0,1'", + "3, '0,2,1'", + "4, '0,2,1,3'", + "5, '0,3,1,4,2'", + "6, '0,3,1,4,2,5'", + "10, '0,5,1,6,2,7,3,8,4,9'", + "50, '0,25,1,26,2,27,3,28,4,29,5,30,6,31,7,32,8,33,9,34,10,35," + + "11,36,12,37,13,38,14,39,15,40,16,41,17,42,18,43,19,44,20,45,21,46," + + "22,47,23,48,24,49'" }) void oddEvenMerge_multi_test(int totalNumberOfPages, String expectedPageOrder) { List newPageOrder = sut.oddEvenMerge(totalNumberOfPages); assertNotNull(newPageOrder, "Returning null instead of page order list"); - assertEquals(Arrays.stream(expectedPageOrder.split(",")).map(Integer::parseInt).toList(), newPageOrder, "Page order doesn't match"); + assertEquals( + Arrays.stream(expectedPageOrder.split(",")).map(Integer::parseInt).toList(), + newPageOrder, + "Page order doesn't match"); } } diff --git a/src/test/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPdfTest.java b/src/test/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPdfTest.java index 986ca55c2..372751e8e 100644 --- a/src/test/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPdfTest.java +++ b/src/test/java/stirling/software/SPDF/controller/api/converters/ConvertWebsiteToPdfTest.java @@ -7,20 +7,16 @@ import org.mockito.MockitoAnnotations; import stirling.software.SPDF.config.RuntimePathConfig; import stirling.software.SPDF.model.api.converters.UrlToPdfRequest; -import stirling.software.SPDF.service.CustomPDDocumentFactory; +import stirling.software.SPDF.service.CustomPDFDocumentFactory; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; public class ConvertWebsiteToPdfTest { + @Mock private CustomPDFDocumentFactory mockPdfDocumentFactory; - @Mock - private CustomPDDocumentFactory mockPdfDocumentFactory; - - @Mock - private RuntimePathConfig runtimePathConfig; - + @Mock private RuntimePathConfig runtimePathConfig; private ConvertWebsiteToPDF convertWebsiteToPDF; @@ -38,9 +34,12 @@ public class ConvertWebsiteToPdfTest { UrlToPdfRequest request = new UrlToPdfRequest(); request.setUrlInput(invalid_format_Url); // Act - IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> { - convertWebsiteToPDF.urlToPdf(request); - }); + IllegalArgumentException thrown = + assertThrows( + IllegalArgumentException.class, + () -> { + convertWebsiteToPDF.urlToPdf(request); + }); // Assert assertEquals("Invalid URL format provided.", thrown.getMessage()); } @@ -53,9 +52,12 @@ public class ConvertWebsiteToPdfTest { UrlToPdfRequest request = new UrlToPdfRequest(); request.setUrlInput(unreachable_Url); // Act - IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> { - convertWebsiteToPDF.urlToPdf(request); - }); + IllegalArgumentException thrown = + assertThrows( + IllegalArgumentException.class, + () -> { + convertWebsiteToPDF.urlToPdf(request); + }); // Assert assertEquals("URL is not reachable, please provide a valid URL.", thrown.getMessage()); }