diff --git a/build.gradle b/build.gradle index e395ccce9..4d55fe831 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.apache.pdfbox:pdfbox:2.0.27' + //implementation 'org.apache.pdfbox:preflight:2.0.27' implementation 'org.apache.logging.log4j:log4j-core:2.20.0' implementation 'e-iceblue:spire.pdf.free:5.1.0' @@ -33,6 +34,11 @@ dependencies { jar { enabled = false + manifest { + attributes 'Implementation-Title': 'Stirling-PDF', + 'Implementation-Version': project.version + } + } tasks.named('test') { @@ -43,3 +49,8 @@ task printVersion { println project.version } +bootRun { + systemProperty 'version', project.version + systemProperties['version'] = version +} + diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index c217625ac..4ba810057 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -2,6 +2,9 @@ package stirling.software.SPDF; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; + +import stirling.software.SPDF.config.AppConfig; @SpringBootApplication public class SPdfApplication { diff --git a/src/main/java/stirling/software/SPDF/config/AppConfig.java b/src/main/java/stirling/software/SPDF/config/AppConfig.java new file mode 100644 index 000000000..5b1242a28 --- /dev/null +++ b/src/main/java/stirling/software/SPDF/config/AppConfig.java @@ -0,0 +1,14 @@ +package stirling.software.SPDF.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +@Configuration +public class AppConfig { + @Bean(name = "appVersion") + public String appVersion() { + String version = getClass().getPackage().getImplementationVersion(); + return (version != null) ? version : "Develop"; + } +} \ No newline at end of file diff --git a/src/main/java/stirling/software/SPDF/controller/SplitPDFController.java b/src/main/java/stirling/software/SPDF/controller/SplitPDFController.java index 1c0fd1554..e159effcd 100644 --- a/src/main/java/stirling/software/SPDF/controller/SplitPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/SplitPDFController.java @@ -134,7 +134,7 @@ public class SplitPDFController { ByteArrayResource resource = new ByteArrayResource(data); new File("split_documents.zip").delete(); // return the Resource in the response - return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=split_documents.zip").contentType(MediaType.APPLICATION_OCTET_STREAM) + return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_split.zip").contentType(MediaType.APPLICATION_OCTET_STREAM) .contentLength(resource.contentLength()).body(resource); } } diff --git a/src/main/java/stirling/software/SPDF/controller/converters/ConvertImgPDFController.java b/src/main/java/stirling/software/SPDF/controller/converters/ConvertImgPDFController.java index 25b58297f..dd8415d08 100644 --- a/src/main/java/stirling/software/SPDF/controller/converters/ConvertImgPDFController.java +++ b/src/main/java/stirling/software/SPDF/controller/converters/ConvertImgPDFController.java @@ -78,7 +78,7 @@ public class ConvertImgPDFController { } else { ByteArrayResource resource = new ByteArrayResource(result); // return the Resource in the response - return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=converted_documents.zip").contentType(MediaType.APPLICATION_OCTET_STREAM) + return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+ file.getOriginalFilename().replaceFirst("[.][^.]+$", "") + "_convertedToImages.zip").contentType(MediaType.APPLICATION_OCTET_STREAM) .contentLength(resource.contentLength()).body(resource); } } diff --git a/src/main/resources/static/images/discord.svg b/src/main/resources/static/images/discord.svg new file mode 100644 index 000000000..84fd00ec4 --- /dev/null +++ b/src/main/resources/static/images/discord.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/main/resources/static/images/docker.svg b/src/main/resources/static/images/docker.svg index 7a761dd01..6cc34c22d 100644 --- a/src/main/resources/static/images/docker.svg +++ b/src/main/resources/static/images/docker.svg @@ -2,4 +2,5 @@ \ No newline at end of file + + diff --git a/src/main/resources/templates/extract-images.html b/src/main/resources/templates/extract-images.html index 1e8fef12c..262a1f88e 100644 --- a/src/main/resources/templates/extract-images.html +++ b/src/main/resources/templates/extract-images.html @@ -15,7 +15,7 @@
-