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 7c81edf2..d3f5c307 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 @@ -28,7 +28,7 @@ public class ConvertWebsiteToPDF { @PostMapping(consumes = "multipart/form-data", value = "/url/pdf") @Operation( summary = "Convert a URL to a PDF", - description = "This endpoint fetches content from a URL and converts it to a PDF format." + description = "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/ExtractController.java b/src/main/java/stirling/software/SPDF/controller/api/converters/ExtractController.java index d9e35c6d..6398e8b9 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/converters/ExtractController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/converters/ExtractController.java @@ -33,7 +33,7 @@ public class ExtractController { private static final Logger logger = LoggerFactory.getLogger(CropController.class); - @PostMapping(value = "/pdf-to-csv", consumes = "multipart/form-data") + @PostMapping(value = "/pdf/csv", consumes = "multipart/form-data") @Operation(summary = "Extracts a PDF document to csv", description = "This operation takes an input PDF file and returns CSV file of whole page. Input:PDF Output:CSV Type:SISO") public ResponseEntity PdfToCsv(@ModelAttribute PDFFilePage form) throws Exception { diff --git a/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java b/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java index d53d8d12..34542da8 100644 --- a/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java +++ b/src/main/java/stirling/software/SPDF/model/api/PDFWithPageNums.java @@ -5,6 +5,7 @@ import java.util.List; import org.apache.pdfbox.pdmodel.PDDocument; +import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -18,7 +19,7 @@ public class PDFWithPageNums extends PDFFile { @Schema(description = "The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')\"") private String pageNumbers; - + @Hidden public List getPageNumbersList(){ int pageCount = 0; try { @@ -30,6 +31,8 @@ public class PDFWithPageNums extends PDFFile { return GeneralUtils.parsePageString(pageNumbers, pageCount); } + + @Hidden public List getPageNumbersList(PDDocument doc){ int pageCount = 0; pageCount = doc.getNumberOfPages(); diff --git a/src/main/resources/static/js/pipeline.js b/src/main/resources/static/js/pipeline.js index 05b0e861..fa26f8f3 100644 --- a/src/main/resources/static/js/pipeline.js +++ b/src/main/resources/static/js/pipeline.js @@ -120,7 +120,16 @@ document.getElementById('submitConfigBtn').addEventListener('click', function() let url = window.URL.createObjectURL(blob); let a = document.createElement('a'); a.href = url; - a.download = 'outputfile'; + + + const contentDisposition = response.headers.get('Content-Disposition'); + let filename = 'download'; + if (contentDisposition && contentDisposition.indexOf('attachment') !== -1) { + filename = decodeURIComponent(contentDisposition.split('filename=')[1].replace(/"/g, '')).trim(); + } + a.download = filename; + + document.body.appendChild(a); a.click(); a.remove(); @@ -173,16 +182,20 @@ fetch('v1/api-docs') operationsByTag[tag].forEach(operationPath => { let option = document.createElement('option'); - console.log("operationPath", operationPath); + let operationPathDisplay = operationPath operationPathDisplay = operationPath.replace(new RegExp("api/v1/" + tag.toLowerCase() + "/", 'i'), ""); - console.log("operationPath2", operationPath); + if(operationPath.includes("/convert")){ - operationPathDisplay = operationPathDisplay.replaceAll("(?

-
+
diff --git a/src/main/resources/templates/pipeline.html b/src/main/resources/templates/pipeline.html index 1b4882f9..3b313f32 100644 --- a/src/main/resources/templates/pipeline.html +++ b/src/main/resources/templates/pipeline.html @@ -34,9 +34,9 @@

-
- + +

Pipeline Menu (Huge work in progress, very buggy!)

- +

Current Limitations

+

Cant have more than one of the same operation

+

Cant input additional files via UI

+ + +

How it works notes

+

Configre pipeline config file and input files to run files against it

+

For reuse, download config file and reupload it when needed or place in /pipeline/defaultWebUIConfigs/ to auto load in webUI for all users

+ + +