Close Menu
    Facebook X (Twitter) Instagram
    Articles Stock
    • Home
    • Technology
    • AI
    • Pages
      • About ArticlesStock — AI & Technology Journalist
      • Contact us
      • Disclaimer For Articles Stock
      • Privacy Policy
      • Terms and Conditions
    Facebook X (Twitter) Instagram
    Articles Stock

    JPG To PDF

    JPG2PDF Pro – Convert Images to PDF /* — CSS SEPARATION START — */ @import url(‘https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap’);:root { –primary: #DC2626; /* Red-600 (PDF Theme) */ –bg-dark: #0F172A; }body { font-family: ‘Inter’, sans-serif; transition: background-color 0.3s, color 0.3s; }/* Image Thumbnail Styling */ .image-item { transition: transform 0.2s, box-shadow 0.2s; } .image-item:hover { transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }/* Loading Spinner */ .loader { border: 3px solid #f3f3f3; border-radius: 50%; border-top: 3px solid #DC2626; width: 20px; height: 20px; animation: spin 1s linear infinite; }@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }/* Dropzone Active */ .dropzone-active { border-color: #DC2626 !important; background-color: rgba(220, 38, 38, 0.05) !important; transform: scale(1.01); }/* Sortable Ghost */ .sortable-ghost { opacity: 0.4; background-color: #fee2e2; border: 2px dashed #DC2626; }/* Dark Mode */ .dark body { background-color: var(–bg-dark); color: #F9FAFB; } .dark .card { background-color: #1E293B; border-color: #334155; } .dark input, .dark select { background-color: #334155; color: white; border-color: #475569; } /* — CSS SEPARATION END — */ tailwind.config = { darkMode: ‘class’, theme: { extend: { colors: { primary: ‘#DC2626’, } } } }
    JPG2PDF Pro

    Convert JPG to PDF

    Combine your images into a single, professional PDF document. Drag and drop to reorder pages.

    Drop Images Here

    JPG, PNG supported. Combine multiple files.

    PDF Settings

    Fit to Image (Variable) A4 (Standard) Letter (US)
    Portrait Landscape Auto (Detect)
    No Margin Small (20px) Large (50px)

    Files (0)

    Drag thumbnails to reorder pages

    PDF Created!

    Your images have been combined successfully.

    Download PDF

    © 2025 JPG2PDF Pro. Secure Client-Side Conversion.

    // — JAVASCRIPT SEPARATION START —// DOM Elements const dropzone = document.getElementById(‘upload-stage’); const editorStage = document.getElementById(‘editor-stage’); const successStage = document.getElementById(‘success-stage’); const fileInput = document.getElementById(‘fileInput’); const imageGrid = document.getElementById(‘image-grid’); const fileCountEl = document.getElementById(‘file-count’); const btnConvert = document.getElementById(‘btn-convert’); const btnText = document.getElementById(‘btn-text’); const btnLoader = document.getElementById(‘btn-loader’); const downloadBtn = document.getElementById(‘download-btn’); // Controls const pdfSize = document.getElementById(‘pdf-size’); const pdfOrientation = document.getElementById(‘pdf-orientation’); const pdfMargin = document.getElementById(‘pdf-margin’);let isDarkMode = false; let images = []; // Array of { id, file, dataUrl } let sortable = null;// — Event Listeners — dropzone.addEventListener(‘click’, () => fileInput.click()); dropzone.addEventListener(‘dragover’, (e) => { e.preventDefault(); dropzone.classList.add(‘dropzone-active’); }); dropzone.addEventListener(‘dragleave’, () => dropzone.classList.remove(‘dropzone-active’)); dropzone.addEventListener(‘drop’, (e) => { e.preventDefault(); dropzone.classList.remove(‘dropzone-active’); if(e.dataTransfer.files.length) handleFiles(e.dataTransfer.files); });fileInput.addEventListener(‘change’, (e) => { if(e.target.files.length) handleFiles(e.target.files); });// Initialize SortableJS for Image Grid sortable = new Sortable(imageGrid, { animation: 150, ghostClass: ‘sortable-ghost’, onEnd: () => { // Visual reorder is handled by DOM, we just read DOM order at generate time } });// — Functions —function addMoreFiles() { fileInput.click(); }function handleFiles(files) { dropzone.classList.add(‘hidden’); editorStage.classList.remove(‘hidden’); successStage.classList.add(‘hidden’);Array.from(files).forEach(file => { if (!file.type.match(‘image.*’)) { alert(‘Skipped non-image file: ‘ + file.name); return; }const id = ‘img-‘ + Math.random().toString(36).substr(2, 9); const reader = new FileReader(); reader.onload = (e) => { const dataUrl = e.target.result; // Store data images.push({ id, file, dataUrl }); // Create UI createImageUI(id, dataUrl, file.name); updateCount(); }; reader.readAsDataURL(file); }); }function createImageUI(id, src, name) { const div = document.createElement(‘div’); div.id = id; div.className = ‘image-item relative aspect-[3/4] bg-gray-100 dark:bg-slate-900 rounded-xl overflow-hidden border dark:border-slate-700 group cursor-grab’; div.innerHTML = ` ${src}
    ${name}
    #
    `; imageGrid.appendChild(div); updateBadges(); }function removeImage(id) { const el = document.getElementById(id); if(el) el.remove(); images = images.filter(img => img.id !== id); updateCount(); updateBadges(); if(images.length === 0) { resetApp(); } }function updateCount() { fileCountEl.innerText = images.length; }function updateBadges() { const items = document.querySelectorAll(‘.image-item’); items.forEach((item, index) => { item.querySelector(‘.page-badge’).innerText = index + 1; }); }async function generatePDF() { if(images.length === 0) return;btnConvert.disabled = true; btnText.innerText = ‘Building PDF…’; btnLoader.classList.remove(‘hidden’);try { const { PDFDocument, PageSizes } = PDFLib; const pdfDoc = await PDFDocument.create();// Get Order from DOM const orderedIds = Array.from(imageGrid.children).map(el => el.id);for (const id of orderedIds) { const imgData = images.find(img => img.id === id); if(!imgData) continue;// Embed Image let image; const imgBytes = await fetch(imgData.dataUrl).then(res => res.arrayBuffer()); // Helper to check format signature // Simple fallback: try png, catch, try jpg try { image = await pdfDoc.embedJpg(imgBytes); } catch (e) { try { image = await pdfDoc.embedPng(imgBytes); } catch (e2) { console.warn(“Could not embed image”, imgData.file.name); continue; } }// Determine Page Size const sizeSetting = pdfSize.value; // fit, a4, letter const orientation = pdfOrientation.value; // portrait, landscape, auto const margin = parseInt(pdfMargin.value);let pageWidth, pageHeight; // Dimensions logic if (sizeSetting === ‘fit’) { // Use image dimensions + margin pageWidth = image.width + (margin * 2); pageHeight = image.height + (margin * 2); } else { // Standard sizes (points) const standard = sizeSetting === ‘a4’ ? PageSizes.A4 : PageSizes.Letter; // Handle Orientation let isLandscape = false; if (orientation === ‘landscape’) isLandscape = true; else if (orientation === ‘auto’) isLandscape = image.width > image.height; pageWidth = isLandscape ? standard[1] : standard[0]; pageHeight = isLandscape ? standard[0] : standard[1]; }const page = pdfDoc.addPage([pageWidth, pageHeight]); // Calculate scaled image dimensions to fit page minus margins const availW = pageWidth – (margin * 2); const availH = pageHeight – (margin * 2); let imgW = image.width; let imgH = image.height; // Scale down if too big const scaleW = availW / imgW; const scaleH = availH / imgH; const scale = Math.min(scaleW, scaleH, 1); // Don’t scale up if smaller and ‘fit’ mode isn’t used, but logic above handles fit differently. // For standard pages, we usually scale to fit. const drawW = imgW * scale; const drawH = imgH * scale;// Center const x = (pageWidth – drawW) / 2; const y = (pageHeight – drawH) / 2;page.drawImage(image, { x: x, y: y, width: drawW, height: drawH, }); }const pdfBytes = await pdfDoc.save(); const blob = new Blob([pdfBytes], { type: ‘application/pdf’ }); const url = URL.createObjectURL(blob);// Show Success editorStage.classList.add(‘hidden’); successStage.classList.remove(‘hidden’); downloadBtn.href = url; downloadBtn.download = ‘images_combined.pdf’;} catch (err) { console.error(err); alert(‘Error creating PDF.’); } finally { btnConvert.disabled = false; btnText.innerText = ‘Create PDF’; btnLoader.classList.add(‘hidden’); } }function resetApp() { fileInput.value = ”; images = []; imageGrid.innerHTML = ”; dropzone.classList.remove(‘hidden’); editorStage.classList.add(‘hidden’); successStage.classList.add(‘hidden’); }function toggleDarkMode() { isDarkMode = !isDarkMode; document.documentElement.classList.toggle(‘dark’); const icon = document.getElementById(‘theme-icon’); if(isDarkMode) { icon.classList.remove(‘fa-moon’); icon.classList.add(‘fa-sun’); } else { icon.classList.remove(‘fa-sun’); icon.classList.add(‘fa-moon’); } }// — JAVASCRIPT SEPARATION END —

    Using JPG To PDF

    The JPG To PDF utility is designed for PDF document tasks. Check the on-page controls for available formats, limits and options. Always review the output for accuracy before sharing or publishing it.

    Practical tips

    • Keep your original files or source information as a backup.
    • Choose suitable options using the controls provided by this tool.
    • Check the generated result and retry with different settings if needed.

    Explore related tools

    Compress PDF and Merge PDF are available for related tasks.

    Categories
    • AI
    • Technology
    Recent Comments
    • Best Mental Health Apps 2026: Top 15 Tested for Anxiety & Wellbeing - Articles Stock on Best EdTech Platforms 2026: Top 15 for Schools, Business & Learners
    • Best EdTech Platforms 2026: Top 15 for Schools, Business & Learners - Articles Stock on What Is Digital Transformation? Complete 2026 Guide
    • Best EdTech Platforms 2026: Top 15 for Schools, Business & Learners - Articles Stock on What Is No-Code Development? Complete 2026 Guide
    Facebook X (Twitter) Instagram Pinterest
    © 2026 articlesstock.com.Thanks for visiting our website.

    Type above and press Enter to search. Press Esc to cancel.