cert change remove requirement for para,s. pdf-to-img dpi fix

This commit is contained in:
Anthony Stirling 2023-05-30 19:45:51 +01:00
parent 2d88987cb3
commit ea1f8912b8
3 changed files with 25 additions and 9 deletions

View File

@ -64,6 +64,7 @@ public class EndpointConfiguration {
addEndpointToGroup("PageOps", "split-pdfs"); addEndpointToGroup("PageOps", "split-pdfs");
addEndpointToGroup("PageOps", "pdf-organizer"); addEndpointToGroup("PageOps", "pdf-organizer");
addEndpointToGroup("PageOps", "rotate-pdf"); addEndpointToGroup("PageOps", "rotate-pdf");
addEndpointToGroup("PageOps", "multi-page-layout");
// Adding endpoints to "Convert" group // Adding endpoints to "Convert" group
addEndpointToGroup("Convert", "pdf-to-img"); addEndpointToGroup("Convert", "pdf-to-img");
@ -82,6 +83,9 @@ public class EndpointConfiguration {
addEndpointToGroup("Security", "remove-password"); addEndpointToGroup("Security", "remove-password");
addEndpointToGroup("Security", "change-permissions"); addEndpointToGroup("Security", "change-permissions");
addEndpointToGroup("Security", "add-watermark"); addEndpointToGroup("Security", "add-watermark");
addEndpointToGroup("Security", "cert-sign");
// Adding endpoints to "Other" group // Adding endpoints to "Other" group
addEndpointToGroup("Other", "ocr-pdf"); addEndpointToGroup("Other", "ocr-pdf");
@ -158,6 +162,9 @@ public class EndpointConfiguration {
addEndpointToGroup("Java", "add-image"); addEndpointToGroup("Java", "add-image");
addEndpointToGroup("Java", "extract-images"); addEndpointToGroup("Java", "extract-images");
addEndpointToGroup("Java", "change-metadata"); addEndpointToGroup("Java", "change-metadata");
addEndpointToGroup("Java", "cert-sign");
addEndpointToGroup("Java", "multi-page-layout");
//Javascript //Javascript

View File

@ -177,8 +177,17 @@ public class CertSignController {
String signingDate = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z").format(new Date()); String signingDate = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z").format(new Date());
// Prepare the text for the digital signature // Prepare the text for the digital signature
String layer2Text = String.format("Digitally signed by: %s\nDate: %s\nReason: %s\nLocation: %s", name, signingDate, reason, location); StringBuilder layer2TextBuilder = new StringBuilder(String.format("Digitally signed by: %s\nDate: %s",
name != null ? name : "Unknown", signingDate));
if (reason != null && !reason.isEmpty()) {
layer2TextBuilder.append("\nReason: ").append(reason);
}
if (location != null && !location.isEmpty()) {
layer2TextBuilder.append("\nLocation: ").append(location);
}
String layer2Text = layer2TextBuilder.toString();
// Get the PDF font and measure the width and height of the text block // Get the PDF font and measure the width and height of the text block
PdfFont font = PdfFontFactory.createFont(StandardFonts.HELVETICA_BOLD); PdfFont font = PdfFontFactory.createFont(StandardFonts.HELVETICA_BOLD);
float textWidth = Arrays.stream(layer2Text.split("\n")) float textWidth = Arrays.stream(layer2Text.split("\n"))
@ -206,12 +215,12 @@ public class CertSignController {
// Configure the appearance of the digital signature // Configure the appearance of the digital signature
appearance.setPageRect(rect) appearance.setPageRect(rect)
.setContact(name) .setContact(name != null ? name : "")
.setPageNumber(pageNumber) .setPageNumber(pageNumber)
.setReason(reason) .setReason(reason != null ? reason : "")
.setLocation(location) .setLocation(location != null ? location : "")
.setReuseAppearance(false) .setReuseAppearance(false)
.setLayer2Text(layer2Text); .setLayer2Text(layer2Text.toString());
signer.setFieldName("sig"); signer.setFieldName("sig");
} else { } else {

View File

@ -43,7 +43,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="dpi">DPI:</label> <label for="dpi">DPI:</label>
<input type="number" name="dpi" class="form-control" id="dpi" min="1" max="100" step="1" value="30" required> <input type="number" name="dpi" class="form-control" id="dpi" min="1" step="1" value="300" required>
</div> </div>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pdfToImage.submit}"></button> <button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pdfToImage.submit}"></button>
</form> </form>