Watermark fixes
This commit is contained in:
parent
4367ae7934
commit
6b618f3abe
3 changed files with 28 additions and 3 deletions
|
@ -44,8 +44,8 @@ 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")
|
||||
public ResponseEntity<byte[]> addWatermark(
|
||||
@RequestPart(required = true, value = "fileInput") @Parameter(description = "The input PDF file to add a watermark") MultipartFile pdfFile,
|
||||
@RequestPart(required = true) @Parameter(description = "The watermark type (text or image)") String watermarkType,
|
||||
@RequestPart(required = false) @Parameter(description = "The watermark text") String watermarkText,
|
||||
@RequestParam(required = true) @Parameter(description = "The watermark type (text or image)") String watermarkType,
|
||||
@RequestParam(required = false) @Parameter(description = "The watermark text") String watermarkText,
|
||||
@RequestPart(required = false) @Parameter(description = "The watermark image") MultipartFile watermarkImage,
|
||||
|
||||
@RequestParam(defaultValue = "roman", name = "alphabet") @Parameter(description = "The selected alphabet",
|
||||
|
|
|
@ -15,7 +15,10 @@ server.error.whitelabel.enabled=false
|
|||
server.error.include-stacktrace=always
|
||||
server.error.include-exception=true
|
||||
server.error.include-message=always
|
||||
\
|
||||
|
||||
#logging.level.org.springframework.web=DEBUG
|
||||
|
||||
|
||||
server.servlet.session.tracking-modes=cookie
|
||||
server.servlet.context-path=${APP_ROOT_PATH:/}
|
||||
|
||||
|
|
|
@ -14,6 +14,13 @@ $(document).ready(function() {
|
|||
const url = this.action;
|
||||
const files = $('#fileInput-input')[0].files;
|
||||
const formData = new FormData(this);
|
||||
|
||||
// Remove empty file entries
|
||||
for (let [key, value] of formData.entries()) {
|
||||
if (value instanceof File && !value.name) {
|
||||
formData.delete(key);
|
||||
}
|
||||
}
|
||||
const override = $('#override').val() || '';
|
||||
const originalButtonText = $('#submitBtn').text();
|
||||
$('#submitBtn').text('Processing...');
|
||||
|
@ -159,6 +166,21 @@ async function submitMultiPdfForm(url, files) {
|
|||
let formData = new FormData($('form')[0]);
|
||||
formData.delete('fileInput');
|
||||
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
|
||||
// Remove empty file entries
|
||||
for (let [key, value] of formData.entries()) {
|
||||
if (value instanceof File && !value.name) {
|
||||
formData.delete(key);
|
||||
}
|
||||
}
|
||||
console.log("## AFTER ## ")
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
|
||||
const CONCURRENCY_LIMIT = 8;
|
||||
const chunks = [];
|
||||
for (let i = 0; i < Array.from(files).length; i += CONCURRENCY_LIMIT) {
|
||||
|
|
Loading…
Reference in a new issue