2023-02-03 21:26:35 +01:00
|
|
|
<!DOCTYPE html>
|
2024-03-21 21:58:01 +01:00
|
|
|
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="http://www.thymeleaf.org">
|
2024-02-16 22:49:06 +01:00
|
|
|
<head>
|
|
|
|
<th:block th:insert="~{fragments/common :: head(title=#{watermark.title}, header=#{watermark.header})}"></th:block>
|
|
|
|
</head>
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2024-02-16 22:49:06 +01:00
|
|
|
<body onload="toggleFileOption()">
|
2023-02-11 15:27:15 +01:00
|
|
|
<div id="page-container">
|
2024-02-16 22:49:06 +01:00
|
|
|
<div id="content-wrap">
|
|
|
|
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
|
2024-03-21 21:58:01 +01:00
|
|
|
<br><br>
|
2024-02-16 22:49:06 +01:00
|
|
|
<div class="container">
|
|
|
|
<div class="row justify-content-center">
|
|
|
|
<div class="col-md-6">
|
2024-03-21 21:58:01 +01:00
|
|
|
<h2 th:text="#{watermark.header}"></h2>
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
<form method="post" enctype="multipart/form-data" action="api/v1/security/add-watermark">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label th:text="#{watermark.selectText.1}"></label>
|
|
|
|
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multiple=false, accept='application/pdf')}">
|
|
|
|
<input type="file" id="fileInput" name="fileInput" class="form-control-file" accept="application/pdf" required>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
<div class="mb-3">
|
|
|
|
<label th:text="#{watermark.selectText.8}"></label>
|
|
|
|
<select class="form-control" id="watermarkType" name="watermarkType" onchange="toggleFileOption()">
|
|
|
|
<option value="text">Text</option>
|
|
|
|
<option value="image">Image</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div id="alphabetGroup" class="mb-3">
|
|
|
|
<label for="fontSize" th:text="#{alphabet} + ':'"></label>
|
|
|
|
<select class="form-control" name="alphabet" id="alphabet-select">
|
|
|
|
<option value="roman">Roman</option>
|
|
|
|
<option value="arabic">العربية</option>
|
|
|
|
<option value="japanese">日本語</option>
|
|
|
|
<option value="korean">한국어</option>
|
|
|
|
<option value="chinese">简体中文</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div id="watermarkTextGroup" class="mb-3">
|
|
|
|
<label for="watermarkText" th:text="#{watermark.selectText.2}"></label>
|
|
|
|
<input type="text" id="watermarkText" name="watermarkText" class="form-control" placeholder="Stirling-PDF" required>
|
|
|
|
</div>
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
<div id="watermarkImageGroup" class="mb-3" style="display: none;">
|
|
|
|
<label for="watermarkImage" th:text="#{watermark.selectText.9}"></label>
|
|
|
|
<input type="file" id="watermarkImage" name="watermarkImage" class="form-control-file" accept="image/*">
|
|
|
|
</div>
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="fontSize" th:text="#{watermark.selectText.3}"></label>
|
|
|
|
<input type="text" id="fontSize" name="fontSize" class="form-control" value="30">
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="opacity" th:text="#{watermark.selectText.7}"></label>
|
|
|
|
<input type="text" id="opacity" name="opacityText" class="form-control" value="50" onblur="updateOpacityValue()">
|
|
|
|
<input type="hidden" id="opacityReal" name="opacity" value="0.5">
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
const opacityInput = document.getElementById('opacity');
|
|
|
|
const opacityRealInput = document.getElementById('opacityReal');
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
const updateOpacityValue = () => {
|
|
|
|
let percentageValue = parseFloat(opacityInput.value.replace('%', ''));
|
|
|
|
if (isNaN(percentageValue)) {
|
|
|
|
percentageValue = 0;
|
|
|
|
}
|
|
|
|
percentageValue = Math.min(Math.max(percentageValue, 0), 100);
|
|
|
|
opacityInput.value = `${percentageValue}`;
|
|
|
|
opacityRealInput.value = (percentageValue / 100).toFixed(2);
|
|
|
|
};
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
const appendPercentageSymbol = () => {
|
|
|
|
if (!opacityInput.value.endsWith('%')) {
|
|
|
|
opacityInput.value += '%';
|
|
|
|
}
|
|
|
|
};
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
opacityInput.addEventListener('focus', () => {
|
|
|
|
opacityInput.value = opacityInput.value.replace('%', '');
|
|
|
|
});
|
|
|
|
opacityInput.addEventListener('blur', () => {
|
|
|
|
updateOpacityValue();
|
|
|
|
appendPercentageSymbol();
|
|
|
|
});
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
// Set initial values
|
|
|
|
updateOpacityValue();
|
|
|
|
appendPercentageSymbol();
|
|
|
|
</script>
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="rotation" th:text="#{watermark.selectText.4}"></label>
|
|
|
|
<input type="text" id="rotation" name="rotation" class="form-control" value="45">
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="widthSpacer" th:text="#{watermark.selectText.5}"></label>
|
|
|
|
<input type="text" id="widthSpacer" name="widthSpacer" class="form-control" value="50">
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="heightSpacer" th:text="#{watermark.selectText.6}"></label>
|
|
|
|
<input type="text" id="heightSpacer" name="heightSpacer" class="form-control" value="50">
|
|
|
|
</div>
|
|
|
|
<div class="mb-3 text-center">
|
|
|
|
<input type="submit" id="submitBtn" th:value="#{watermark.submit}" class="btn btn-primary">
|
|
|
|
</div>
|
|
|
|
</form>
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
<script>
|
|
|
|
function toggleFileOption() {
|
|
|
|
const watermarkType = document.getElementById('watermarkType').value;
|
|
|
|
const watermarkTextGroup = document.getElementById('watermarkTextGroup');
|
|
|
|
const watermarkImageGroup = document.getElementById('watermarkImageGroup');
|
|
|
|
const alphabetGroup = document.getElementById('alphabetGroup'); // This is the new addition
|
|
|
|
const watermarkText = document.getElementById('watermarkText');
|
|
|
|
const watermarkImage = document.getElementById('watermarkImage');
|
2024-02-16 22:49:06 +01:00
|
|
|
|
2024-03-21 21:58:01 +01:00
|
|
|
if (watermarkType === 'text') {
|
|
|
|
watermarkTextGroup.style.display = 'block';
|
|
|
|
watermarkText.required = true;
|
|
|
|
watermarkImageGroup.style.display = 'none';
|
|
|
|
watermarkImage.required = false;
|
|
|
|
alphabetGroup.style.display = 'block';
|
|
|
|
} else if (watermarkType === 'image') {
|
|
|
|
watermarkTextGroup.style.display = 'none';
|
|
|
|
watermarkText.required = false;
|
|
|
|
watermarkImageGroup.style.display = 'block';
|
|
|
|
watermarkImage.required = true;
|
|
|
|
alphabetGroup.style.display = 'none';
|
2024-02-16 22:49:06 +01:00
|
|
|
}
|
2024-03-21 21:58:01 +01:00
|
|
|
}
|
|
|
|
</script>
|
2023-02-11 15:27:15 +01:00
|
|
|
</div>
|
2024-02-16 22:49:06 +01:00
|
|
|
</div>
|
2023-02-11 15:27:15 +01:00
|
|
|
</div>
|
2024-02-16 22:49:06 +01:00
|
|
|
</div>
|
|
|
|
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
|
2023-02-11 15:27:15 +01:00
|
|
|
</div>
|
2024-02-16 22:49:06 +01:00
|
|
|
</body>
|
2024-03-21 21:58:01 +01:00
|
|
|
</html>
|