mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-11 02:10:11 +01:00
Css changes (#1899)
* #1841 Signed-off-by: a <a> * #1841 for watermark Signed-off-by: a <a> * #1869 and ensure naming Signed-off-by: a <a> --------- Signed-off-by: a <a> Co-authored-by: a <a>
This commit is contained in:
parent
2cfb553320
commit
9661e94092
@ -21,7 +21,9 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-12 bg-card">
|
<div class="col-md-12 bg-card">
|
||||||
|
<form>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div id="sliders-container" style="display:none;">
|
<div id="sliders-container" style="display:none;">
|
||||||
<h4><span th:text="#{adjustContrast.contrast}"></span> <span id="contrast-val">100</span>%</h4>
|
<h4><span th:text="#{adjustContrast.contrast}"></span> <span id="contrast-val">100</span>%</h4>
|
||||||
@ -48,7 +50,9 @@
|
|||||||
<button id="download-button" class="btn btn-primary" th:text="#{adjustContrast.download}"></button>
|
<button id="download-button" class="btn btn-primary" th:text="#{adjustContrast.download}"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var canvas = document.getElementById('contrast-pdf-canvas');
|
var canvas = document.getElementById('contrast-pdf-canvas');
|
||||||
@ -219,7 +223,7 @@
|
|||||||
function adjustBrightnessForPixel(pixel, brightness) {
|
function adjustBrightnessForPixel(pixel, brightness) {
|
||||||
return Math.max(0, Math.min(255, pixel * brightness));
|
return Math.max(0, Math.min(255, pixel * brightness));
|
||||||
}
|
}
|
||||||
|
let inputFileName = '';
|
||||||
async function downloadPDF() {
|
async function downloadPDF() {
|
||||||
for (var i = 0; i < allPages.length; i++) {
|
for (var i = 0; i < allPages.length; i++) {
|
||||||
await renderPageAndAdjustImageProperties(allPages[i]);
|
await renderPageAndAdjustImageProperties(allPages[i]);
|
||||||
@ -248,7 +252,10 @@
|
|||||||
// Create download link
|
// Create download link
|
||||||
const downloadLink = document.createElement('a');
|
const downloadLink = document.createElement('a');
|
||||||
downloadLink.href = URL.createObjectURL(blob);
|
downloadLink.href = URL.createObjectURL(blob);
|
||||||
downloadLink.download = "download.pdf";
|
let newFileName = inputFileName ? inputFileName.replace('.pdf', '') : 'download';
|
||||||
|
newFileName += '_adjusted_color.pdf';
|
||||||
|
|
||||||
|
downloadLink.download = newFileName;
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
|
|
||||||
// After download, reset the viewer and clear stored data
|
// After download, reset the viewer and clear stored data
|
||||||
@ -264,6 +271,7 @@
|
|||||||
// Event listeners
|
// Event listeners
|
||||||
document.getElementById('fileInput-input').addEventListener('change', function(e) {
|
document.getElementById('fileInput-input').addEventListener('change', function(e) {
|
||||||
if (e.target.files.length > 0) {
|
if (e.target.files.length > 0) {
|
||||||
|
inputFileName = e.target.files[0].name;
|
||||||
renderPDFAndSaveOriginalImageData(e.target.files[0]);
|
renderPDFAndSaveOriginalImageData(e.target.files[0]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -172,16 +172,23 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function toggleFileOption() {
|
function toggleFileOption() {
|
||||||
|
const stampImage = document.getElementById('stampImage');
|
||||||
const stampType = document.getElementById('stampType').value;
|
const stampType = document.getElementById('stampType').value;
|
||||||
const stampTextGroup = document.getElementById('stampTextGroup');
|
const stampTextGroup = document.getElementById('stampTextGroup');
|
||||||
const stampImageGroup = document.getElementById('stampImageGroup');
|
const stampImageGroup = document.getElementById('stampImageGroup');
|
||||||
const alphabetGroup = document.getElementById('alphabetGroup');
|
const alphabetGroup = document.getElementById('alphabetGroup');
|
||||||
|
|
||||||
if (stampType === 'text') {
|
if (stampType === 'text') {
|
||||||
|
if (stampImage.hasAttribute('required')) {
|
||||||
|
stampImage.removeAttribute('required');
|
||||||
|
}
|
||||||
stampTextGroup.style.display = 'block';
|
stampTextGroup.style.display = 'block';
|
||||||
stampImageGroup.style.display = 'none';
|
stampImageGroup.style.display = 'none';
|
||||||
alphabetGroup.style.display = 'block';
|
alphabetGroup.style.display = 'block';
|
||||||
} else if (stampType === 'image') {
|
} else if (stampType === 'image') {
|
||||||
|
if (!stampImage.hasAttribute('required')) {
|
||||||
|
stampImage.setAttribute('required', '');
|
||||||
|
}
|
||||||
stampTextGroup.style.display = 'none';
|
stampTextGroup.style.display = 'none';
|
||||||
stampImageGroup.style.display = 'block';
|
stampImageGroup.style.display = 'block';
|
||||||
alphabetGroup.style.display = 'none';
|
alphabetGroup.style.display = 'none';
|
||||||
|
@ -123,12 +123,18 @@
|
|||||||
const watermarkImage = document.getElementById('watermarkImage');
|
const watermarkImage = document.getElementById('watermarkImage');
|
||||||
|
|
||||||
if (watermarkType === 'text') {
|
if (watermarkType === 'text') {
|
||||||
|
if (watermarkImage.hasAttribute('required')) {
|
||||||
|
watermarkImage.removeAttribute('required');
|
||||||
|
}
|
||||||
watermarkTextGroup.style.display = 'block';
|
watermarkTextGroup.style.display = 'block';
|
||||||
watermarkText.required = true;
|
watermarkText.required = true;
|
||||||
watermarkImageGroup.style.display = 'none';
|
watermarkImageGroup.style.display = 'none';
|
||||||
watermarkImage.required = false;
|
watermarkImage.required = false;
|
||||||
alphabetGroup.style.display = 'block';
|
alphabetGroup.style.display = 'block';
|
||||||
} else if (watermarkType === 'image') {
|
} else if (watermarkType === 'image') {
|
||||||
|
if (watermarkImage.hasAttribute('required')) {
|
||||||
|
watermarkImage.removeAttribute('required');
|
||||||
|
}
|
||||||
watermarkTextGroup.style.display = 'none';
|
watermarkTextGroup.style.display = 'none';
|
||||||
watermarkText.required = false;
|
watermarkText.required = false;
|
||||||
watermarkImageGroup.style.display = 'block';
|
watermarkImageGroup.style.display = 'block';
|
||||||
|
Loading…
Reference in New Issue
Block a user