first completed version. sorting for booklets
This commit is contained in:
parent
0917a059cb
commit
9feaa3b089
56
assets/css/custom.css
Normal file
56
assets/css/custom.css
Normal file
@ -0,0 +1,56 @@
|
||||
/* Custom Styles */
|
||||
#drop-area {
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
#drop-area.drag-over {
|
||||
background-color: #e9ecef;
|
||||
}
|
||||
|
||||
/* Imposition Preview Styles */
|
||||
.sheet-preview {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
margin-bottom: 15px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.sheet-side {
|
||||
width: 48%;
|
||||
border: 1px dashed #6c757d;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page-preview {
|
||||
display: inline-block;
|
||||
width: 45%;
|
||||
height: 100px;
|
||||
line-height: 100px;
|
||||
border: 1px solid #ced4da;
|
||||
margin: 5px;
|
||||
background-color: #e9ecef;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.blank-page {
|
||||
background-color: #6c757d;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#recommendation-table th,
|
||||
#recommendation-table td {
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
|
||||
#drop-area.loaded {
|
||||
padding: 1rem !important;
|
||||
min-height: auto;
|
||||
}
|
||||
301
assets/js/main.js
Normal file
301
assets/js/main.js
Normal file
@ -0,0 +1,301 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const { PDFDocument } = PDFLib;
|
||||
|
||||
const dropArea = document.getElementById('drop-area');
|
||||
const fileInput = document.getElementById('file-input');
|
||||
const fileSelectBtn = document.getElementById('file-select-btn');
|
||||
const pdfInfo = document.getElementById('pdf-info');
|
||||
const pdfFilename = document.getElementById('pdf-filename');
|
||||
const pdfPageCount = document.getElementById('pdf-page-count');
|
||||
const pdfPaperCount = document.getElementById('pdf-paper-count');
|
||||
const previewBtn = document.getElementById('preview-btn');
|
||||
const exportSingleBtn = document.getElementById('export-single-btn');
|
||||
const exportZipBtn = document.getElementById('export-zip-btn');
|
||||
const bookletSizeInput = document.getElementById('booklet-size');
|
||||
const firstBookletSizeInput = document.getElementById('first-booklet-size');
|
||||
const blankPagesInput = document.getElementById('blank-pages-start');
|
||||
|
||||
let originalPdfBytes = null;
|
||||
let originalPageCount = 0;
|
||||
|
||||
// Event Listeners
|
||||
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
||||
dropArea.addEventListener(eventName, preventDefaults, false);
|
||||
document.body.addEventListener(eventName, preventDefaults, false);
|
||||
});
|
||||
['dragenter', 'dragover'].forEach(eventName => dropArea.addEventListener(eventName, () => dropArea.classList.add('drag-over'), false));
|
||||
['dragleave', 'drop'].forEach(eventName => dropArea.addEventListener(eventName, () => dropArea.classList.remove('drag-over'), false));
|
||||
dropArea.addEventListener('drop', handleDrop, false);
|
||||
fileSelectBtn.addEventListener('click', () => fileInput.click());
|
||||
fileInput.addEventListener('change', handleFileSelect, false);
|
||||
previewBtn.addEventListener('click', updatePreview);
|
||||
exportSingleBtn.addEventListener('click', exportAsSinglePdf);
|
||||
exportZipBtn.addEventListener('click', exportAsZip);
|
||||
|
||||
|
||||
function preventDefaults(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function handleDrop(e) {
|
||||
handleFiles(e.dataTransfer.files);
|
||||
}
|
||||
|
||||
function handleFileSelect(e) {
|
||||
handleFiles(e.target.files);
|
||||
}
|
||||
|
||||
async function handleFiles(files) {
|
||||
if (files.length > 0) {
|
||||
const file = files[0];
|
||||
if (file.type === 'application/pdf') {
|
||||
pdfFilename.textContent = file.name;
|
||||
dropArea.classList.add('loaded');
|
||||
dropArea.querySelector('p').textContent = 'Drag & drop or click to select a different PDF.';
|
||||
const fileReader = new FileReader();
|
||||
fileReader.onload = async function() {
|
||||
originalPdfBytes = new Uint8Array(this.result);
|
||||
try {
|
||||
const pdfDoc = await PDFDocument.load(originalPdfBytes);
|
||||
originalPageCount = pdfDoc.getPageCount();
|
||||
pdfPageCount.textContent = originalPageCount;
|
||||
const paperCount = Math.ceil(originalPageCount / 4);
|
||||
pdfPaperCount.textContent = paperCount;
|
||||
pdfInfo.classList.remove('d-none');
|
||||
document.getElementById('recommendation-section').classList.remove('d-none');
|
||||
previewBtn.disabled = false;
|
||||
exportSingleBtn.disabled = false;
|
||||
exportZipBtn.disabled = false;
|
||||
updateRecommendationTable();
|
||||
updatePreview(); // Auto-update preview on new file
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert('Failed to load PDF. The file may be corrupt.');
|
||||
}
|
||||
};
|
||||
fileReader.readAsArrayBuffer(file);
|
||||
} else {
|
||||
alert('Please select a PDF file.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function padAndImposeBooklet(bookletPages) {
|
||||
const paddedBookletSize = Math.ceil(bookletPages.length / 4) * 4;
|
||||
while (bookletPages.length < paddedBookletSize) {
|
||||
bookletPages.push({ type: 'blank' });
|
||||
}
|
||||
return imposeBooklet(bookletPages);
|
||||
}
|
||||
|
||||
function calculateImposition() {
|
||||
const bookletSize = parseInt(bookletSizeInput.value, 10);
|
||||
let firstBookletSize = parseInt(firstBookletSizeInput.value, 10) || bookletSize;
|
||||
const blankPagesAtStart = parseInt(blankPagesInput.value, 10) || 0;
|
||||
|
||||
if (bookletSize % 4 !== 0 || (firstBookletSize && firstBookletSize % 4 !== 0)) {
|
||||
alert('Booklet sizes must be a multiple of 4.');
|
||||
return null;
|
||||
}
|
||||
|
||||
const totalPages = originalPageCount + blankPagesAtStart;
|
||||
let sourcePages = [];
|
||||
for (let i = 0; i < blankPagesAtStart; i++) sourcePages.push({ type: 'blank' });
|
||||
for (let i = 1; i <= originalPageCount; i++) sourcePages.push({ type: 'pdf', pageNum: i });
|
||||
|
||||
let booklets = [];
|
||||
|
||||
// First booklet
|
||||
let firstBookletActualSize = (firstBookletSize > 0 && totalPages > 0) ? firstBookletSize : bookletSize;
|
||||
if (totalPages < firstBookletSize) {
|
||||
firstBookletActualSize = Math.ceil(totalPages / 4) * 4;
|
||||
}
|
||||
|
||||
const firstBookletPages = sourcePages.splice(0, firstBookletActualSize);
|
||||
booklets.push(padAndImposeBooklet(firstBookletPages));
|
||||
|
||||
// Remaining booklets
|
||||
while (sourcePages.length > 0) {
|
||||
const bookletPages = sourcePages.splice(0, bookletSize);
|
||||
booklets.push(padAndImposeBooklet(bookletPages));
|
||||
}
|
||||
|
||||
return booklets;
|
||||
}
|
||||
|
||||
function imposeBooklet(bookletPages) {
|
||||
const size = bookletPages.length;
|
||||
const imposed = [];
|
||||
for (let i = 0; i < size / 2; i += 2) {
|
||||
imposed.push(bookletPages[size - 1 - i]);
|
||||
imposed.push(bookletPages[i]);
|
||||
imposed.push(bookletPages[i + 1]);
|
||||
imposed.push(bookletPages[size - 2 - i]);
|
||||
}
|
||||
return imposed;
|
||||
}
|
||||
|
||||
function updatePreview() {
|
||||
const booklets = calculateImposition();
|
||||
if (!booklets) return;
|
||||
|
||||
const previewArea = document.getElementById('imposition-preview');
|
||||
let html = '';
|
||||
|
||||
booklets.forEach((booklet, index) => {
|
||||
html += `<h5 class="mt-3">Booklet ${index + 1}</h5>`;
|
||||
for (let i = 0; i < booklet.length; i += 4) {
|
||||
const sheetPages = booklet.slice(i, i + 4);
|
||||
html += `
|
||||
<div class="sheet-preview">
|
||||
<div class="sheet-side">
|
||||
<strong>Front</strong>
|
||||
<div class="page-preview ${sheetPages[0].type === 'blank' ? 'blank-page' : ''}">${sheetPages[0].type === 'blank' ? 'BLANK' : 'Page ' + sheetPages[0].pageNum}</div>
|
||||
<div class="page-preview ${sheetPages[1].type === 'blank' ? 'blank-page' : ''}">${sheetPages[1].type === 'blank' ? 'BLANK' : 'Page ' + sheetPages[1].pageNum}</div>
|
||||
</div>
|
||||
<div class="sheet-side">
|
||||
<strong>Back</strong>
|
||||
<div class="page-preview ${sheetPages[2].type === 'blank' ? 'blank-page' : ''}">${sheetPages[2].type === 'blank' ? 'BLANK' : 'Page ' + sheetPages[2].pageNum}</div>
|
||||
<div class="page-preview ${sheetPages[3].type === 'blank' ? 'blank-page' : ''}">${sheetPages[3].type === 'blank' ? 'BLANK' : 'Page ' + sheetPages[3].pageNum}</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
});
|
||||
|
||||
previewArea.innerHTML = html;
|
||||
}
|
||||
|
||||
async function createBookletPdf(booklet, srcDoc) {
|
||||
const { width, height } = srcDoc.getPage(0).getSize();
|
||||
const newDoc = await PDFDocument.create();
|
||||
|
||||
for (const pageInfo of booklet) {
|
||||
if (pageInfo.type === 'pdf') {
|
||||
const [copiedPage] = await newDoc.copyPages(srcDoc, [pageInfo.pageNum - 1]);
|
||||
newDoc.addPage(copiedPage);
|
||||
} else {
|
||||
newDoc.addPage([width, height]);
|
||||
}
|
||||
}
|
||||
return newDoc;
|
||||
}
|
||||
|
||||
async function exportAsSinglePdf() {
|
||||
if (!originalPdfBytes) {
|
||||
alert('Please upload a PDF first.');
|
||||
return;
|
||||
}
|
||||
|
||||
exportSingleBtn.disabled = true;
|
||||
exportSingleBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Exporting...';
|
||||
|
||||
const booklets = calculateImposition();
|
||||
if (!booklets) {
|
||||
exportSingleBtn.disabled = false;
|
||||
exportSingleBtn.textContent = 'Export as Single PDF';
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const srcDoc = await PDFDocument.load(originalPdfBytes);
|
||||
const mergedPdf = await PDFDocument.create();
|
||||
|
||||
for (const booklet of booklets) {
|
||||
const bookletPdf = await createBookletPdf(booklet, srcDoc);
|
||||
const copiedPages = await mergedPdf.copyPages(bookletPdf, bookletPdf.getPageIndices());
|
||||
copiedPages.forEach((page) => mergedPdf.addPage(page));
|
||||
}
|
||||
|
||||
const pdfBytes = await mergedPdf.save();
|
||||
download(pdfBytes, `imposed-booklet.pdf`, "application/pdf");
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert('An error occurred while exporting the PDF.');
|
||||
} finally {
|
||||
exportSingleBtn.disabled = false;
|
||||
exportSingleBtn.textContent = 'Export as Single PDF';
|
||||
}
|
||||
}
|
||||
|
||||
async function exportAsZip() {
|
||||
if (!originalPdfBytes) {
|
||||
alert('Please upload a PDF first.');
|
||||
return;
|
||||
}
|
||||
|
||||
exportZipBtn.disabled = true;
|
||||
exportZipBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Exporting...';
|
||||
|
||||
const booklets = calculateImposition();
|
||||
if (!booklets) {
|
||||
exportZipBtn.disabled = false;
|
||||
exportZipBtn.textContent = 'Export as ZIP';
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const srcDoc = await PDFDocument.load(originalPdfBytes);
|
||||
const zip = new JSZip();
|
||||
|
||||
for (let i = 0; i < booklets.length; i++) {
|
||||
const booklet = booklets[i];
|
||||
const bookletPdf = await createBookletPdf(booklet, srcDoc);
|
||||
const pdfBytes = await bookletPdf.save();
|
||||
zip.file(`booklet-${i + 1}.pdf`, pdfBytes);
|
||||
}
|
||||
|
||||
const zipBytes = await zip.generateAsync({ type: "blob" });
|
||||
download(zipBytes, 'booklets.zip', 'application/zip');
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert('An error occurred while exporting the ZIP file.');
|
||||
} finally {
|
||||
exportZipBtn.disabled = false;
|
||||
exportZipBtn.textContent = 'Export as ZIP';
|
||||
}
|
||||
}
|
||||
|
||||
function download(data, filename, type) {
|
||||
const blob = new Blob([data], { type: type });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.style.display = 'none';
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
|
||||
function updateRecommendationTable() {
|
||||
if (originalPageCount === 0) return;
|
||||
|
||||
const tableBody = document.getElementById('recommendation-table-body');
|
||||
tableBody.innerHTML = ''; // Clear existing rows
|
||||
|
||||
const totalPages = originalPageCount + (parseInt(blankPagesInput.value, 10) || 0);
|
||||
|
||||
for (let size = 4; size <= 32; size += 4) {
|
||||
const numBooklets = Math.ceil(totalPages / size);
|
||||
const lastBookletSize = totalPages % size || size;
|
||||
|
||||
const row = `
|
||||
<tr>
|
||||
<td>${size}</td>
|
||||
<td>${numBooklets}</td>
|
||||
<td>${lastBookletSize}</td>
|
||||
</tr>
|
||||
`;
|
||||
tableBody.innerHTML += row;
|
||||
|
||||
if (numBooklets === 1) {
|
||||
break; // Stop after the first size that fits all pages
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
262
index.php
262
index.php
@ -1,150 +1,124 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<?php endif; ?>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loader {
|
||||
margin: 1.25rem auto 1.25rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PDF Booklet Creator</title>
|
||||
<meta name="description" content="Create print-ready booklets from PDF files.">
|
||||
<meta name="keywords" content="pdf booklet, imposition, print-ready, booklet creator, pdf tools, prepress, printing, book binding, Built with Flatlogic Generator">
|
||||
<meta property="og:title" content="PDF Booklet Creator">
|
||||
<meta property="og:description" content="Create print-ready booklets from PDF files.">
|
||||
<meta property="og:image" content="">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
</div>
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
|
||||
<header class="bg-primary text-white text-center p-3">
|
||||
<h1>PDF Booklet Creator</h1>
|
||||
<p class="lead">Create print-ready booklets from your PDF files</p>
|
||||
</header>
|
||||
|
||||
<main class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
PDF Import
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="drop-area" class="border rounded p-5 text-center">
|
||||
<p>Drag & drop a PDF file here or click to select</p>
|
||||
<input type="file" id="file-input" class="d-none" accept=".pdf">
|
||||
<button id="file-select-btn" class="btn btn-secondary">Select PDF</button>
|
||||
</div>
|
||||
<div id="pdf-info" class="mt-3 d-none">
|
||||
<h5>PDF Information</h5>
|
||||
<p><strong>Filename:</strong> <span id="pdf-filename"></span></p>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<p><strong>Page Count:</strong> <span id="pdf-page-count"></span></p>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<p><strong>Paper Sheets Required:</strong> <span id="pdf-paper-count"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="recommendation-section" class="mt-3 d-none">
|
||||
<h5>Booklet Size Recommendations</h5>
|
||||
<table id="recommendation-table" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Booklet Size</th>
|
||||
<th>Number of Booklets</th>
|
||||
<th>Last Booklet Size</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recommendation-table-body">
|
||||
<!-- Rows will be added here dynamically -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Booklet Settings
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<div class="mb-4">
|
||||
<label for="booklet-size" class="form-label">Booklet Size <i class="bi bi-info-circle" title="The number of pages in each booklet (must be a multiple of 4)."></i></label>
|
||||
<input type="number" class="form-control" id="booklet-size" value="16" step="4" min="4">
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label for="first-booklet-size" class="form-label">First Booklet Pages <i class="bi bi-info-circle" title="Optional: Use a smaller page count for the first booklet."></i></label>
|
||||
<input type="number" class="form-control" id="first-booklet-size">
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label for="blank-pages-start" class="form-label">Blank Pages at Start <i class="bi bi-info-circle" title="Add blank pages to the beginning of the first booklet."></i></label>
|
||||
<input type="number" class="form-control" id="blank-pages-start" value="0" min="0">
|
||||
</div>
|
||||
<div class="d-grid gap-2">
|
||||
<button type="button" class="btn btn-primary" id="preview-btn" disabled><i class="bi bi-eye"></i> Preview</button>
|
||||
<button type="button" class="btn btn-success" id="export-single-btn" disabled><i class="bi bi-file-earmark-pdf"></i> Export as Single PDF</button>
|
||||
<button type="button" class="btn btn-info" id="export-zip-btn" disabled><i class="bi bi-file-earmark-zip"></i> Export as ZIP</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Imposition Preview
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="imposition-preview" class="p-3 bg-light rounded" style="min-height: 100px; font-family: monospace;">
|
||||
<p class="text-muted">Click "Preview" to see the imposed page order.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="text-center mt-4 p-3 bg-light">
|
||||
<p>Built with <a href="https://flatlogic.com/" target="_blank">Flatlogic</a></p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://unpkg.com/pdf-lib@1.17.1/dist/pdf-lib.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user