pipeline changes
This commit is contained in:
parent
eab9e3cffc
commit
93f12d1313
6 changed files with 38 additions and 12 deletions
|
@ -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<byte[]> urlToPdf(@ModelAttribute UrlToPdfRequest request) throws IOException, InterruptedException {
|
||||
String URL = request.getUrlInput();
|
||||
|
|
|
@ -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<String> PdfToCsv(@ModelAttribute PDFFilePage form)
|
||||
throws Exception {
|
||||
|
|
|
@ -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<Integer> getPageNumbersList(){
|
||||
int pageCount = 0;
|
||||
try {
|
||||
|
@ -30,6 +31,8 @@ public class PDFWithPageNums extends PDFFile {
|
|||
return GeneralUtils.parsePageString(pageNumbers, pageCount);
|
||||
|
||||
}
|
||||
|
||||
@Hidden
|
||||
public List<Integer> getPageNumbersList(PDDocument doc){
|
||||
int pageCount = 0;
|
||||
pageCount = doc.getNumberOfPages();
|
||||
|
|
|
@ -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("(?<!^)/", " to ");
|
||||
console.log("operationPathDisplay", operationPathDisplay);
|
||||
operationPathDisplay = operationPathDisplay.replace(/^\//, '').replaceAll("/", " to ");
|
||||
|
||||
console.log("operationPathDisplay2", operationPathDisplay);
|
||||
} else {
|
||||
operationPathDisplay = operationPathDisplay.replace(/\//g, ''); // Remove slashes
|
||||
}
|
||||
operationPathDisplay = operationPathDisplay.replaceAll(" ","-");
|
||||
option.textContent = operationPathDisplay;
|
||||
option.value = operationPath; // Keep the value with slashes for querying
|
||||
group.appendChild(option);
|
||||
|
@ -482,7 +495,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
|
|||
a.href = URL.createObjectURL(new Blob([JSON.stringify(pipelineConfig, null, 2)], {
|
||||
type: 'application/json'
|
||||
}));
|
||||
a.download = 'pipelineConfig.json';
|
||||
a.download = pipelineName + '.json';
|
||||
a.style.display = 'none';
|
||||
|
||||
document.body.appendChild(a);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h2 th:text="#{PDFToCSV.header}"></h2>
|
||||
<form id="PDFToCSVForm" th:action="@{api/v1/convert/pdf-to-csv}" method="post" enctype="multipart/form-data">
|
||||
<form id="PDFToCSVForm" th:action="@{api/v1/convert/pdf/csv}" method="post" enctype="multipart/form-data">
|
||||
<input id="pageId" type="hidden" name="pageId" />
|
||||
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multiple=false, accept='application/pdf')}"></div>
|
||||
<button type="submit" class="btn btn-primary" th:text="#{PDFToCSV.submit}"></button>
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
|
||||
<br> <br>
|
||||
<div class="container">
|
||||
|
||||
<div class="row justify-content-center">
|
||||
|
||||
<h1>Pipeline Menu (Huge work in progress, very buggy!)</h1>
|
||||
<div class="bordered-box">
|
||||
<div class="text-end text-top">
|
||||
<button id="uploadPipelineBtn" class="btn btn-primary">Upload
|
||||
|
@ -63,6 +63,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Current Limitations</h3>
|
||||
<p>Cant have more than one of the same operation</p>
|
||||
<p>Cant input additional files via UI</p>
|
||||
|
||||
|
||||
<h3>How it works notes</h3>
|
||||
<p>Configre pipeline config file and input files to run files against it</p>
|
||||
<p>For reuse, download config file and reupload it when needed or place in /pipeline/defaultWebUIConfigs/ to auto load in webUI for all users</p>
|
||||
|
||||
|
||||
|
||||
<!-- The Modal -->
|
||||
<div class="modal" id="pipelineSettingsModal">
|
||||
|
|
Loading…
Reference in a new issue