{"id":82,"date":"2026-11-25T03:54:20","date_gmt":"2026-11-25T03:54:20","guid":{"rendered":"https:\/\/sushiljoshi.in\/?p=82"},"modified":"2026-11-25T03:54:23","modified_gmt":"2026-11-25T03:54:23","slug":"image-to-pdf-online-tool","status":"publish","type":"post","link":"https:\/\/sushiljoshi.in\/index.php\/2026\/11\/25\/image-to-pdf-online-tool\/","title":{"rendered":"Image to PDF Online Tool"},"content":{"rendered":"\n<meta charset=\"UTF-8\">\n  <title>Image to PDF Converter<\/title>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <script src=\"https:\/\/cdn.tailwindcss.com\"><\/script>\n  <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/2.5.1\/jspdf.umd.min.js\"><\/script>\n\n\n  <div class=\"bg-white rounded-2xl shadow-xl p-6 w-full max-w-3xl\">\n    <h1 class=\"text-3xl font-bold text-center text-indigo-700 mb-6\">\ud83d\uddbc\ufe0f Image to PDF Online Tool<\/h1>\n\n    <!-- Upload -->\n    <input type=\"file\" id=\"imageUpload\" accept=\"image\/*\" multiple=\"\" class=\"w-full mb-4 text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:bg-indigo-500 file:text-white hover:file:bg-indigo-600\">\n\n    <!-- Page Size -->\n    <div class=\"mb-4\">\n      <label class=\"block text-gray-700 font-medium mb-2\">Select Paper Size:<\/label>\n      <select id=\"paperSize\" class=\"w-full p-2 border rounded-lg\">\n        <option value=\"a4\">A4 (210\u00d7297 mm)<\/option>\n        <option value=\"letter\">Letter (8.5\u00d711 in)<\/option>\n        <option value=\"fit\">Auto Fit to Image<\/option>\n      <\/select>\n    <\/div>\n\n    <!-- Preview -->\n    <div id=\"previewContainer\" class=\"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4 hidden\">\n      <!-- Thumbnails injected here -->\n    <\/div>\n\n    <!-- Buttons -->\n    <div class=\"flex justify-center gap-4\">\n      <button onclick=\"generatePDF()\" class=\"bg-green-500 hover:bg-green-600 text-white font-semibold py-2 px-4 rounded-xl shadow-md\">\n        Convert to PDF\n      <\/button>\n      <button onclick=\"resetTool()\" class=\"bg-gray-500 hover:bg-gray-600 text-white font-semibold py-2 px-4 rounded-xl shadow-md\">\n        Reset\n      <\/button>\n    <\/div>\n  <\/div>\n\n  <script>\n    const { jsPDF } = window.jspdf;\n    const imageUpload = document.getElementById(\"imageUpload\");\n    const previewContainer = document.getElementById(\"previewContainer\");\n    let imageFiles = [];\n\n    imageUpload.addEventListener(\"change\", () => {\n      imageFiles = Array.from(imageUpload.files);\n      previewContainer.innerHTML = '';\n      if (imageFiles.length) previewContainer.classList.remove('hidden');\n\n      imageFiles.forEach(file => {\n        const reader = new FileReader();\n        reader.onload = (e) => {\n          const img = document.createElement('img');\n          img.src = e.target.result;\n          img.className = \"w-full object-cover rounded shadow\";\n          previewContainer.appendChild(img);\n        };\n        reader.readAsDataURL(file);\n      });\n    });\n\n    async function generatePDF() {\n      if (!imageFiles.length) {\n        alert(\"Please upload at least one image.\");\n        return;\n      }\n\n      const paperSize = document.getElementById(\"paperSize\").value;\n      let pdf = null;\n\n      for (let i = 0; i < imageFiles.length; i++) {\n        const imgData = await readImageAsDataURL(imageFiles[i]);\n        const img = await loadImage(imgData);\n\n        let width, height;\n        if (paperSize === 'a4') {\n          width = 210; height = 297;\n        } else if (paperSize === 'letter') {\n          width = 216; height = 279;\n        } else {\n          width = img.width * 0.2646; \/\/ px to mm\n          height = img.height * 0.2646;\n        }\n\n        if (i === 0) {\n          pdf = new jsPDF({ unit: \"mm\", format: [width, height] });\n        } else {\n          pdf.addPage([width, height]);\n        }\n\n        const ratio = Math.min(width \/ img.width, height \/ img.height);\n        const imgW = img.width * ratio;\n        const imgH = img.height * ratio;\n        const x = (width - imgW) \/ 2;\n        const y = (height - imgH) \/ 2;\n\n        pdf.addImage(img, \"JPEG\", x, y, imgW, imgH);\n      }\n\n      pdf.save(\"images-to-pdf.pdf\");\n    }\n\n    function readImageAsDataURL(file) {\n      return new Promise((resolve, reject) => {\n        const reader = new FileReader();\n        reader.onload = () => resolve(reader.result);\n        reader.onerror = reject;\n        reader.readAsDataURL(file);\n      });\n    }\n\n    function loadImage(src) {\n      return new Promise((resolve, reject) => {\n        const img = new Image();\n        img.onload = () => resolve(img);\n        img.onerror = reject;\n        img.src = src;\n      });\n    }\n\n    function resetTool() {\n      imageUpload.value = '';\n      imageFiles = [];\n      previewContainer.innerHTML = '';\n      previewContainer.classList.add('hidden');\n    }\n  <\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffffff\" class=\"has-inline-color\">how to convert images into pdf online, image to pdf iphone, image to pdf, extract images from pdf online, free online pdf tools, convert image t<\/mark><a href=\"https:\/\/sushiljoshi.in\/\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffffff\" class=\"has-inline-color\">o<\/mark><\/a><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffffff\" class=\"has-inline-color\"> pdf, save image to pdf, convert image to pdf on iphone, how to convert image to pdf, how to convert image to pdf on iphone, image to pdf converter, images to pdf, change image to pdf, how to convert image into pdf, image convert to pdf, <\/mark><a href=\"http:\/\/gyantak.com\" target=\"_blank\" rel=\"noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffffff\" class=\"has-inline-color\">how<\/mark><\/a><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffffff\" class=\"has-inline-color\"> to combine images into one pdf, convert image to pdf instantly, image to pdf converter app, how to convert image to pdf file<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Image to PDF Converter \ud83d\uddbc\ufe0f Image to PDF Online Tool Select Paper Size: A4 (210\u00d7297 mm)Letter (8.5\u00d711 in)Auto Fit to Image Convert to PDF Reset how to convert images into pdf online, image to pdf iphone, image to pdf, extract images from pdf online, free online pdf tools, convert image to pdf, save image to &#8230; <a title=\"Image to PDF Online Tool\" class=\"read-more\" href=\"https:\/\/sushiljoshi.in\/index.php\/2026\/11\/25\/image-to-pdf-online-tool\/\" aria-label=\"Read more about Image to PDF Online Tool\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[116,87],"tags":[172,166,174,165,162,163,173,171,167,168,159,176,161,170,175,160,169,164],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-tool","category-new-updates","tag-change-image-to-pdf","tag-convert-image-to-pdf","tag-convert-image-to-pdf-instantly","tag-convert-image-to-pdf-on-iphone","tag-extract-images-from-pdf-online","tag-free-online-pdf-tools","tag-how-to-combine-images-into-one-pdf","tag-how-to-convert-image-into-pdf","tag-how-to-convert-image-to-pdf","tag-how-to-convert-image-to-pdf-on-iphone","tag-how-to-convert-images-into-pdf-online","tag-image-convert-to-pdf","tag-image-to-pdf","tag-image-to-pdf-converter","tag-image-to-pdf-converter-app","tag-image-to-pdf-iphone","tag-images-to-pdf","tag-save-image-to-pdf"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":2,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts\/82\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}