PageSourceSearch

https://kerneltools.dev/assets/MergePdf-CzcIR2H3.js

js kerneltools.dev collected 2026-10-02 01:52:41 UTC 13,438 bytes, 1 lines download raw bytes

1import{r as o,u as X,j as e,L as O}from"./index-j7I9Tmll.js";import{f as y,i as I,M as $,p as W}from"./pdfEditor-C_FHqbws.js";function G(){var R;const[i,F]=o.useState([]),[l,x]=o.useState(!1),[A,a]=o.useState("Choose two or more PDFs to get started."),[P,c]=o.useState(""),[u,v]=o.useState(null),[f,g]=o.useState(null),[D,U]=o.useState(!1),[d,T]=o.useState("merge"),[k,B]=o.useState(!1),p=o.useRef(null),h=o.useRef(null),N=o.useRef(null),j=o.useRef(null);o.useEffect(()=>{var s;f&&((s=j.current)==null||s.focus())},[f]),X({title:"Merge PDF Files Online Free | Kernel Tools",description:"Combine PDF files in your chosen order, entirely in your browser. Merge up to 50 files and 250 pages, then download one PDF. No file uploads or signup.",keywords:["merge pdf","combine pdf files","join pdf documents","merge pdf online free"],structuredData:{"@context":"https://schema.org","@type":"SoftwareApplication",name:"Merge PDF",applicationCategory:"UtilitiesApplication",operatingSystem:"Web",url:"https://kerneltools.dev/merge-pdf",offers:{"@type":"Offer",price:"0",priceCurrency:"USD"}}}),o.useEffect(()=>()=>{var s;(s=p.current)==null||s.terminate(),h.current&&URL.revokeObjectURL(h.current)},[]);function m(){h.current&&URL.revokeObjectURL(h.current),h.current=null,v(null)}function C(s){if(l||!s.length)return;const n=[...i,...Array.from(s).map(t=>({id:crypto.randomUUID(),file:t}))],r=n.reduce((t,b)=>t+b.file.size,0);if(c(""),n.some(t=>!I(t.file)))return c("Choose PDF files only. No files were added.");if(n.length>50)return c("Choose no more than 50 files. No files were added.");if(r>$)return c("The combined file size must be 100 MB or less. No files were added.");W(r)==="confirm"&&!window.confirm("These files total more than 25 MB. Merging may use significant memory on this device. Continue?")||(m(),F(n),a(`${n.length} PDFs selected. Arrange them in the order you want.`))}function w(s){m(),c(""),F(s),a(`${s.length} PDFs selected. Arrange them in the order you want.`)}function M(s,n){const r=[...i];[r[s],r[s+n]]=[r[s+n],r[s]],w(r)}function E(){var s;(s=p.current)==null||s.terminate(),p.current=null,x(!1),g(null),a("Merge cancelled. Your selected files are still available.")}function z(){var s;if(!(l||i.length<2)){m(),c(""),x(!0),a("Preparing your PDFs…");try{let n=function(){r.terminate(),p.current=null,x(!1),g(null)};const r=new Worker(new URL("/assets/merge.worker-Tb3WaeO6.js",import.meta.url),{type:"module"});p.current=r,r.onmessage=({data:t})=>{if(p.current===r&&(t.type==="password"&&(g(t),a(`Password needed for file ${t.index}. Processing is paused.`)),t.type==="progress"&&a(`Read ${t.completed} of ${t.total} PDFs${t.completed===t.total?". Saving merged PDF…":"…"}`),t.type==="error"&&(n(),c(t.message),a("Merge stopped. No output was created.")),t.type==="result")){try{const b=new Blob([t.bytes],{type:"application/pdf"});h.current=URL.createObjectURL(b),v({url:h.current,size:b.size,warnings:t.warnings,pageCount:t.pageCount}),a(d==="portfolio"?"Your PDF Portfolio is ready to download.":"Your merged PDF is ready to download.")}catch{c("The browser could not prepare the download. Try fewer or smaller PDFs."),a("Download could not be prepared.")}n()}},r.onerror=()=>{p.current===r&&(n(),c("The PDF worker could not run. Try again with fewer or smaller files."),a("Merge stopped."))},r.postMessage({type:"merge",files:i.map(t=>t.file),allowSigned:D,convertXfa:k,mode:d})}catch{(s=p.current)==null||s.terminate(),p.current=null,x(!1),g(null),c("This browser could not start PDF processing. Try a current browser."),a("Merge could not start.")}}}function L(s){var r;s.preventDefault();const n=j.current.value;j.current.value="",(r=p.current)==null||r.postMessage({type:"password",password:n}),g(null),a("Opening the protected PDF…")}const S=i.reduce((s,n)=>s+n.file.size,0);return e.jsxs("div",{className:"pdf-tools-page",children:[e.jsx(O,{className:"pdf-tools-back",to:"/pdf-tools",children:"← All PDF tools"}),e.jsxs("header",{className:"pdf-tools-heading",children:[e.jsx("span",{className:"pdf-tools-eyebrow",children:"PROCESSED IN YOUR BROWSER · NO SIGNUP"}),e.jsx("h1",{children:"Merge PDF files"}),e.jsxs("p",{children:["One report. One packet. One PDF.",e.jsx("br",{}),"Combine your documents in the order you choose."]})]}),e.jsxs("section",{className:"pdf-tool-workspace","aria-label":"Merge PDF workspace",children:[e.jsxs("div",{className:"pdf-assembly-layout",children:[e.jsxs("div",{className:"pdf-assembly-source",children:[e.jsxs("div",{className:"pdf-workspace-step",children:[e.jsx("span",{children:"01"}),e.jsx("h2",{children:"Build your document queue"})]}),e.jsxs("div",{className:"pdf-tool-drop",onDragOver:s=>s.preventDefault(),onDrop:s=>{s.preventDefault(),C(s.dataTransfer.files)},children:[e.jsx("span",{className:"pdf-tool-symbol","aria-hidden":"true",children:"+"}),e.jsx("h2",{children:"Add your PDF files"}),e.jsx("p",{children:"Drop files here or choose them from your device."}),e.jsx("input",{ref:N,type:"file",multiple:!0,accept:"application/pdf,.pdf",hidden:!0,onChange:s=>{C(s.target.files),s.target.value=""}}),e.jsx("button",{className:"btn btn-primary",disabled:l,onClick:()=>N.current.click(),children:"Choose PDF files"}
1),e.jsx("small",{children:"Up to 50 files · 100 MB combined · 250 pages total"})]}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pdf-tool-list-heading",children:[e.jsx("h2",{children:"File order"}),e.jsxs("span",{children:[i.length," files · ",y(S)]})]}),e.jsx("ol",{className:"pdf-tool-files",children:i.map(({id:s,file:n},r)=>e.jsxs("li",{children:[e.jsx("span",{className:"pdf-tool-position",children:r+1}),e.jsxs("div",{className:"pdf-tool-file-name",children:[e.jsx("strong",{children:n.name}),e.jsx("small",{children:y(n.size)})]}),e.jsxs("div",{className:"pdf-tool-file-actions",children:[e.jsx("button",{className:"btn btn-ghost",disabled:l||r===0,"aria-label":`Move ${n.name} up`,onClick:()=>M(r,-1),children:"↑"}),e.jsx("button",{className:"btn btn-ghost",disabled:l||r===i.length-1,"aria-label":`Move ${n.name} down`,onClick:()=>M(r,1),children:"↓"}),e.jsx("button",{className:"btn btn-ghost",disabled:l,"aria-label":`Remove ${n.name}`,onClick:()=>w(i.filter(t=>t.id!==s)),children:"Remove"})]})]},s))})]}),!i.length&&e.jsx("p",{className:"pdf-queue-empty",children:"Your document order will appear here. Move files up or down before creating the output."})]}),e.jsxs("aside",{className:"pdf-assembly-output","aria-label":"Output settings",children:[e.jsxs("div",{className:"pdf-workspace-step",children:[e.jsx("span",{children:"02"}),e.jsx("h2",{children:"Choose the output"})]}),e.jsxs("dl",{className:"pdf-assembly-summary",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Selected files"}),e.jsx("dd",{children:i.length})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Combined input size"}),e.jsx("dd",{children:y(S)})]})]}),e.jsxs("label",{className:"pdf-merge-consent",children:["Output ",e.jsxs("select",{"aria-label":"Output type",value:d,disabled:l,onChange:s=>{T(s.target.value),m()},children:[e.jsx("option",{value:"merge",children:"Merge pages into one PDF"}),e.jsx("option",{value:"portfolio",children:"PDF Portfolio — preserve original files"})]})]}),d==="portfolio"?e.jsx("p",{children:"A Portfolio packages the original files as separate attachments. Dynamic XFA forms remain editable in a compatible reader. Original passwords, signatures and scripts remain unchanged; pages are not combined. Open with a Portfolio-capable reader such as Acrobat."}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"pdf-merge-consent",children:[e.jsx("input",{id:"convert-static-xfa",type:"checkbox",checked:k,disabled:l,onChange:s=>{B(s.target.checked),m()}})," Convert compatible static XFA to its saved AcroForm representation. I will review the values and appearance; XFA behavior will be removed. Dynamic or data-bound XFA needs Portfolio output."]}),e.jsxs("label",{className:"pdf-merge-consent",children:[e.jsx("input",{id:"allow-signed-copy",type:"checkbox",checked:D,disabled:l,onChange:s=>{U(s.target.checked),m()}})," Allow signed inputs as unsigned copies. I understand original digital signatures will be removed and the merged PDF will not be signed or certified."]})]})]})]}),f&&e.jsxs("form",{className:"pdf-merge-password",onSubmit:L,"aria-labelledby":"merge-password-title",children:[e.jsx("h2",{id:"merge-password-title",children:"Open protected PDF"}),e.jsx("p",{children:f.name}),f.attempt>1&&e.jsx("p",{role:"alert",children:"That password was not accepted. Try again."}),e.jsx("label",{htmlFor:"merge-password",children:"PDF password"}),e.jsx("input",{ref:j,id:"merge-password",type:"password",autoComplete:"off"}),e.jsx("p",{children:"Used in this tab only. The merged download will be unencrypted."}),e.jsx("button",{className:"btn btn-primary",type:"submit",children:"Unlock and continue"})]}),e.jsxs("div",{className:"pdf-tool-actions",children:[e.jsx("button",{className:"btn btn-primary",disabled:l||i.length<2,onClick:z,children:l?"Merging…":d==="portfolio"?"Create Portfolio":"Merge PDFs"}),l?e.jsx("button",{className:"btn btn-ghost",onClick:E,children:"Cancel"}):i.length>0&&e.jsx("button",{className:"btn btn-ghost",onClick:()=>w([]),children:"Clear files"}),u&&e.jsxs("a",{className:"btn btn-primary",href:u.url,download:d==="portfolio"?"portfolio.pdf":"merged.pdf",children:["Download ",d==="portfolio"?"PDF Portfolio":"merged PDF"," (",y(u.size),")"]})]}),e.jsx("p",{role:"status","aria-live":"polite","aria-atomic":"true",children:A}),P&&e.jsx("p",{className:"pdf-tool-error",role:"alert",children:P}),u&&e.jsxs("section",{className:"pdf-merge-report","aria-label":"Merge report",children:[e.jsxs("h2",{children:[d==="portfolio"?"Portfolio report":"Merge report"," · ",u.pageCount," ",d==="portfolio"?"cover pages":"pages"]}),d==="merge"&&e.jsx("p",{children:"Output is unencrypted. Document information comes from the first file. Bookmark groups, field names, and attachment entries are labeled by input file."}),((R=u.warnings)==null?void 0:R.length)>0&&e.jsx("ul",{children:u.warnings.map(s=>e.jsx("li",{children:s},s))})]}),e.jsx("p",{className:"pdf-tool-privacy",children:"PDF contents are processed on this device. This tool does not upload your files or save them between visits."})]}),e.jsxs("div",{className:"pdf-tools-grid pdf-tool-info",children:[e.jsxs("section",{children:[e.jsx("h2",{children:"How to merge PDFs"}),e.jsxs("ol",{children:[e.jsx("li",{children:"Choose at least two PDF documents."}),e.jsx("li",{children:"Use the arrows to put the files in order."}),e.jsx("li",{children:"Select Merge PDFs, then download the result."})]})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Bring related pages together"}),e.jsxs("ul",{children:[e.jsx("li",{children:"Join a cover sheet, report, and appendix."}),e.jsx("li",{children:"Combine scanned receipts into a single packet."}),e.jsx("li",{children:"Collect separate handouts into one PDF."})]})]})]}),e.jsxs("section",{className:"pdf-tool-info",children:[e.jsx("h2",{children:"Before you merge"}),e.jsxs("details",{children:[e.jsx("summary",{children:"Which PDFs can I combine?"}),e.jsx("p",{children:"Text, image, and scanned PDFs, including password-protected files you can unlock. Bookmarks, AcroForms, annotations, links, PDF 1.x and PDF 2.0 tag namespaces, layers, and attachments are retained. Compatible static XFA can be converted with your acknowledgement. For dynamic XFA, choose Portfolio to package unchanged originals as 
1separate files."})]}),e.jsxs("details",{children:[e.jsx("summary",{children:"What happens to forms, signatures, and metadata?"}),e.jsx("p",{children:"Form names receive a file prefix to keep duplicate names independent. Supported arithmetic and aggregate calculation scripts are rewritten for those names and retained; other scripts are removed and reported. Recalculation requires a reader with form scripting enabled. Signed files require your acknowledgement: the merged result is an unsigned, unencrypted copy. Document information comes from the first file; XMP conformance claims and document-open actions are omitted. Portfolio attachments preserve their original bytes."})]}),e.jsxs("details",{children:[e.jsx("summary",{children:"Will the result be accessible?"}),e.jsx("p",{children:"Existing tag trees, reading-order children, page references, and parent mappings are retained in input order. Untagged pages remain untagged. The tool does not certify PDF/UA compliance; review the result with an accessibility checker and assistive technology before distribution."})]}),e.jsxs("details",{children:[e.jsx("summary",{children:"Will the page quality change?"}),e.jsx("p",{children:"The tool copies pages without rasterizing them or deliberately recompressing images. Each page keeps its original dimensions and rotation."})]}),e.jsxs("details",{children:[e.jsx("summary",{children:"Is there a file size limit?"}),e.jsx("p",{children:"Select up to 50 PDFs totaling 100 MB, with a combined maximum of 250 pages. Large or complex files may exceed your device’s memory even within these limits. You can cancel processing at any time."})]}),e.jsxs("details",{children:[e.jsx("summary",{children:"Can I edit pages after merging?"}),e.jsxs("p",{children:["Download the merged document and open it in the ",e.jsx(O,{to:"/pdf-editor",children:"PDF Editor"})," to work on individual pages."]})]})]})]})}export{G as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.