1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66564],{22390:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(78340).A)("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]])},23224:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(78340).A)("rectangle-vertical",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]])},40175:(e,t,l)=>{async function a(e,t={}){let l,o=(l="<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; style-src 'unsafe-inline'; img-src https: http: data: blob:; font-src https: http: data:;\">",e.includes("</head>")?e.replace("</head>",`${l}</head>`):e.includes("<head>")?e.replace("<head>",`<head>${l}`):/<html[\s>]/i.test(e)?e.replace(/<html([^>]*)>/i,`<html$1><head>${l}</head>`):`<!DOCTYPE html><html><head>${l}</head><body>${e}</body></html>`),r=document.createElement("iframe");r.setAttribute("title",t.title??"pdf-print-frame"),r.setAttribute("sandbox","allow-same-origin"),r.style.cssText=`position:absolute;left:-9999px;top:0;width:${t.width??"210mm"};height:${t.height??"1400px"};border:0;visibility:hidden`,r.srcdoc=o,document.body.appendChild(r),await new Promise((e,t)=>{r.onload=()=>e(),r.onerror=()=>t(Error("Failed to load print frame"))});let n=r.contentDocument,i=n?.body;if(!n||!i)throw document.body.removeChild(r),Error("Print frame has no body");return{document:n,body:i,iframe:r,cleanup:()=>{r.parentNode&&r.parentNode.removeChild(r)}}}l.d(t,{P:()=>c});var o=l(91992);let r=["script","iframe","object","embed","form","base","meta","link","applet","noscript","template","frame","frameset"];var n=l(25384);let i=/\b(hsl|hsla|lab|oklch|lch|color-mix|hwb|color)\s*\(/gi;function s(e){let t="",l=0;for(;l<e.length;){i.lastIndex=l;let a=i.exec(e);if(!a){t+=e.slice(l);break}let o=a.index;if(o>0&&/[a-zA-Z0-9_-]/.test(e[o-1])){t+=e.slice(l,o+a[0].length),l=o+a[0].length;continue}t+=e.slice(l,o);let r=o+a[0].length-1,n=0,s=r;for(;s<e.length;s++){let t=e[s];if("("===t)n++;else if(")"===t&&0==--n){s++;break}}t+="rgb(0, 0, 0)",l=s}return t}function d(e){e.querySelectorAll('link[rel="stylesheet"]').forEach(e=>e.remove()),e.querySelectorAll("style").forEach(e=>e.remove());let t=e.createElement("style");t.textContent=n.PZ,e.head?.appendChild(t);let l=e.documentElement;l&&(l.style.color="#24292f",l.style.backgroundColor="#ffffff");let a=e.body;a&&(a.style.color="#24292f",a.style.backgroundColor="#ffffff"),e.querySelectorAll("*").forEach(t=>{if(!(t instanceof HTMLElement))return;let l=t.getAttribute("style");l&&t.setAttribute("style",s(l));let a=e.defaultView;if(!a)return;let o=a.getComputedStyle(t);for(let e of["color","background-color","border-top-color","border-right-color","border-bottom-color","border-left-color","outline-color"]){let l=o.getPropertyValue(e);l&&"transparent"!==l&&"rgba(0, 0, 0, 0)"!==l&&(l.includes("hsl")||l.includes("lab")||l.includes("oklch")||l.includes("color(")||t.style.setProperty(e,l))}})}async function c(e,t){let n,{pageSize:i,orientation:c,qualityPercent:h,compress:m,onProgress:u,applyMarkdownBodyStyles:g=!1,html2canvasOnClone:p,html2canvasOptions:f,resolveHtml2canvasOptions:b}=t,y=function(e){var t;let l;return e.trim()?(t={wholeDocument:!0},(l=o.default)?l.sanitize(e,{WHOLE_DOCUMENT:t.wholeDocument,ADD_TAGS:["style"],FORBID_TAGS:[...r],ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1}):""):""}(e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>`<style>${s(t)}</style>`).replace(/\sstyle\s*=\s*(["'])([\s\S]*?)\1/gi,(e,t,l)=>` style=${t}${s(l)}${t}`));u?.(15);let{document:x,body:v,cleanup:w}=await a(y,{title:g?"markdown-print-frame":"html-print-frame"});if(g){let e=x.documentElement;e&&(e.style.color="#24292f",e.style.backgroundColor="#ffffff"),v.style.color="#24292f",v.style.backgroundColor="#ffffff"}u?.(35),await new Promise(e=>setTimeout(e,400));let T=(n=({A4:{width:210,height:297},Letter:{width:216,height:279},Legal:{width:216,height:356},A3:{width:297,height:420},A5:{width:148,height:210},Tabloid:{width:279,height:432}}
1)[i],"landscape"===c?{width:n.height,height:n.width}:n),k=function(e){if(e.marginsMm)return e.marginsMm;let t=Math.min(48,Math.max(4,e.marginMm??14));return[t,t,t,t]}(t),P=b?.({body:v})??{},C=g?e=>{d(e)}:void 0,A=p??C,j={margin:k,filename:`document-${Date.now()}.pdf`,image:{type:"jpeg",quality:h/100},html2canvas:{scale:f?.scale??2,useCORS:!0,logging:!1,backgroundColor:"#ffffff",allowTaint:!0,...f,...P,...A?{onclone:A}:{}},jsPDF:{unit:"mm",format:[T.width,T.height],orientation:c,compress:m}};u?.(55);let S=(await Promise.all([l.e(14316),l.e(74628)]).then(l.t.bind(l,9686,23))).default,$=console.warn,L=console.error,M=(...e)=>{let t=e.map(String).join(" ");return t.includes("color function")||t.includes("Attempting to parse")||t.includes("hsl")||t.includes("lab")||t.includes("oklch")||t.includes("lch")};console.warn=(...e)=>{M(...e)||$.apply(console,e)},console.error=(...e)=>{M(...e)||L.apply(console,e)};try{u?.(75);let e=await S().set(j).from(v).outputPdf("blob");return u?.(100),e}catch(l){let e;if(!((e=l instanceof Error?l.message:String(l)).includes("unsupported color function")||e.includes("color function")||e.includes("hsl")||e.includes("oklch")||e.includes("lab("))||!g)throw l;u?.(80);let t=await S().set({...j,html2canvas:{...j.html2canvas,onclone:e=>{d(e),e.querySelectorAll("*").forEach(e=>{e instanceof HTMLElement&&e.removeAttribute("class")})}}}).from(v).outputPdf("blob");return u?.(100),t}finally{console.warn=$,console.error=L,w()}}},48274:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(78340).A)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]])},66564:(e,t,l)=>{l.r(t),l.d(t,{HtmlToPdfTool:()=>w});var a=l(95155),o=l(83899),r=l(63054),n=l(12115),i=l(58092),s=l(48274),d=l(95057),c=l(23224),h=l(66669),m=l(22390),u=l(48368),g=l(67514),p=l(83952),f=l(47910),b=l(60753),y=l(94251),x=l(40175);function v(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(){let e=(0,p.c)(),[t,l]=(0,n.useState)("A4"),[w,T]=(0,n.use
1State)("portrait"),[k,P]=(0,n.useState)(95),[C,A]=(0,n.useState)(20),[j,S]=(0,n.useState)(20),[$,L]=(0,n.useState)(20),[M,F]=(0,n.useState)(20),[N,D]=(0,n.useState)(!1),[H,E]=(0,n.useState)(""),[z,O]=(0,n.useState)(!1),[_,q]=(0,n.useState)(""),[R,B]=(0,n.useState)(!0),[G,W]=(0,n.useState)(!0),[Y,V]=(0,n.useState)(!0),[Z,U]=(0,n.useState)(""),[I,Q]=(0,n.useState)("landing"),K=e.htmlToPdf?.title??"Advanced HTML to PDF Converter",J={title:e.htmlToPdf?.title??"Advanced HTML to PDF Converter",description:e.htmlToPdf?.subtitle??"Convert HTML files to PDF with full CSS support, custom page sizes, headers, and footers.",subtitle:"Upload HTML (.html, .htm) files and convert them to highâquality PDFs in your browser.",badge:e.htmlToPdf?.badge??"HTML to PDF",icon:s.A,accept:".html,.htm,text/html",maxFiles:r.kH,maxFileSizeBytes:r.fR,supportedFormatsLabel:`Max ${r.kH} files ⢠Max file size: 50MB ⢠Supported: .html, .htm, text/html`},X={selectFiles:"Select HTML Files",dragDropHint:"or Drag & drop HTML files here",selectedFilesTitle:"Selected Files",addFiles:"Add files",convertButton:e.htmlToPdf?.convert??"Convert to PDF",processingTitle:"Converting Your Files",processingStatus:e.htmlToPdf?.converting??"Converting...",cancelProcessing:"Cancel Processing",processingComplete:"Conversion completed!",yourFileReady:"Your PDF is ready for download",yourFilesReady:"Your PDFs are ready for download",download:e.htmlToPdf?.results?.download??"Download",processMoreFiles:"Convert More HTML Files",clearAll:void 0,settingsTitle:e.htmlToPdf?.settings?.title??"Conversion Settings"},ee=(0,n.useCallback)(e=>{let t=[{pattern:/lab\([^()]*(?:\([^()]*\)[^()]*)*\)/gi,replacement:"rgb(0, 0, 0)"},{pattern:/oklch\([^()]*(?:\([^()]*\)[^()]*)*\)/gi,replacement:"rgb(0, 0, 0)"},{pattern:/lch\([^()]*(?:\([^()]*\)[^()]*)*\)/gi,replacement:"rgb(0, 0, 0)"},{pattern:/color-mix\([^()]*(?:\([^()]*\)[^()]*)*\)/gi,replacement:"rgb(0, 0, 0)"},{pattern:/hwb\([^()]*(?:\([^()]*\)[^()]*)*\)/gi,replacement:"rgb(0, 0, 0)"}],l=e;return t.forEach(({pattern:e,replacement:t})=>{l=l.replace(e,t)}),l=l.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,l)=>{let a=l;return t.forEach(({pattern:e,replacement:t})=>{a=a.replace(e,t)}),`<style>${a}</style>`})},[]),et=(0,n.useCallback)(e=>{let t=e.trim();if(t.includes("<html")||t.includes("<!DOCTYPE")?Z&&(t=t.includes("</head>")?t.replace("</head>",`<style>${Z}</style></head>`):t.includes("<head>")?t.replace("<head>",`<head><style>${Z}</style>`):`<head><style>${Z}</style></head>${t}`):t=`<!DOCTYPE html> 2<html> 3<head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <title>Document</title> 7 ${Z?`<style>${Z}</style>`:""} 8</head> 9<body> 10 ${t} 11</body> 12</html>`,R){let e=` 13 <style> 14 @media print { 15 .page-break { 16 page-break-before: always; 17 } 18 .no-break { 19 page-break-inside: avoid; 20 } 21 } 22 </style> 23 `;t.includes("</head>")?t=t.replace("</head>",`${e}</head>`):t.includes("<head>")&&(t=t.replace("<head>",`<head>${e}`))}if(N||z){let e=` 24 <style> 25 @media print { 26 @page { 27 margin-top: ${C}mm; 28 margin-bottom: ${j}mm; 29 margin-left: ${$}mm; 30 margin-right: ${M}mm; 31 } 32 .pdf-header { 33 position: fixed; 34 top: 0; 35 left: 0; 36 right: 0; 37 height: 20mm; 38 text-align: center; 39 padding: 5mm; 40 border-bottom: 1px solid #ccc; 41 } 42 .pdf-footer { 43 position: fixed; 44 bottom: 0; 45 left: 0; 46 right: 0; 47 height: 20mm; 48 text-align: center; 49 padding: 5mm; 50 border-top: 1px solid #ccc; 51 } 52 body { 53 margin-top: ${N?"25mm":"0"}; 54 margin-bottom: ${z?"25mm":"0"}; 55 } 56 } 57 </style> 58 `;t.includes("</head>")&&(t=t.replace("</head>",`${e}</head>`));let l="";N&&H&&(l+=`<div class="pdf-header">${v(H)}</div>`),z&&_&&(l+=`<div class="pdf-footer">${v(_)}</div>`),t.includes("<body>")?t=t.replace("<body>",`<body>${l}`):t.includes("</head>")&&(t=t.replace("</head>",`</head><body>${l}`))}return t},[Z,R,N,z,C,j,$,M,H,_]),el=(0,n.useCallback)(async(e,l)=>{let a=et(ee(e));return(0,x.P)(a,{pageSize:t,orientation:w,marginsMm:[C,M,j,$],qualityPercent:k,compress:Y,onProgress:l})},[ee,et,t,w,C,M,j,$,k,Y]),ea=(0,n.useCallback)(async(e,t)=>{let l=await e.text();if(!l.trim())throw Error("HTML file is empty");let a=await el(l,t),o=e.name.replace(/\.(html?|HTML?)$/u,"");return{id:`${o}-${Date.now()}
58`,fileName:`${o}.pdf`,blob:a,size:a.size}},[el]),eo=(0,n.useCallback)(async(e,t)=>{if(!e.length)return[];let l=[];for(let a=0;a<e.length;a+=1){let o=await ea(e[a],l=>{let o=100*(a/e.length)+l/100*(1/e.length)*100;t?.onProgress?.(o)});l.push(o)}return t?.onProgress?.(100),l},[ea]),er=(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(b.wG,{label:e.htmlToPdf?.settings?.pageSize??"Page Size",tooltip:y.x.pageSize,icon:d.A}),(0,a.jsx)(i.Z,{options:[{value:"A4",label:"A4 (210 \xd7 297 mm)"},{value:"Letter",label:"Letter (8.5 \xd7 11 in)"},{value:"Legal",label:"Legal (8.5 \xd7 14 in)"},{value:"A3",label:"A3 (297 \xd7 420 mm)"},{value:"A5",label:"A5 (148 \xd7 210 mm)"},{value:"Tabloid",label:"Tabloid (11 \xd7 17 in)"}],value:t,onChange:e=>l(e)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(b.wG,{label:e.htmlToPdf?.settings?.orientation??"Orientation",tooltip:y.x.orientation,icon:c.A}),(0,a.jsx)(i.Z,{options:[{value:"portrait",label:e.htmlToPdf?.settings?.portrait??"Portrait"},{value:"landscape",label:e.htmlToPdf?.settings?.landscape??"Landscape"}],value:w,onChange:e=>T(e)})]}),(0,a.jsx)(b.mA,{label:e.htmlToPdf?.settings?.quality??"Quality",value:k,onChange:e=>P(Math.round(e)),min:10,max:100,step:5,unit:"%",helperTextLeft:e.htmlToPdf?.settings?.lower??"Lower Quality (smaller file)",helperTextRight:e.htmlToPdf?.settings?.higher??"Higher Quality (larger file)",tooltip:y.x.quality,icon:h.A}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(b.wG,{label:e.htmlToPdf?.settings?.margins??"Margins (mm)",tooltip:y.x.margin,icon:m.A}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:e.htmlToPdf?.settings?.top??"Top"}),(0,a.jsx)("input",{type:"number",min:0,max:100,value:C,onChange:e=>A(Number(e.target.value)),className:"w-full h-8 px-2 rounded-md border border-input bg-background text-sm text-center"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:e.htmlToPdf?.settings?.bottom??"Bottom"}),(0,a.jsx)("input",{type:"number",min:0,max:100,value:j,onChange:e=>S(Number(e.target.value)),className:"w-full h-8 px-2 rounded-md border border-input bg-background text-sm text-center"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:e.htmlToPdf?.settings?.left??"Left"}),(0,a.jsx)("input",{type:"number",min:0,max:100,value:$,onChange:e=>L(Number(e.target.value)),className:"w-full h-8 px-2 rounded-md border border-input bg-background text-sm text-center"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:e.htmlToPdf?.settings?.right??"Right"}),(0,a.jsx)("input",{type:"number",min:0,max:100,value:M,onChange:e=>F(Number(e.target.value)),className:"w-full h-8 px-2 rounded-md border border-input bg-background text-sm text-center"})]})]})]}),(0,a.jsxs)(b.fN,{title:"Headers & Footers",children:[(0,a.jsx)(b.T_,{label:"Enable Header",checked:N,onChange:D,tooltip:"Add a repeating header line at the top of every PDF page."}),N&&(0,a.jsx)(b.NL,{label:"Header text",value:H,onChange:E,placeholder:"Header text (e.g., Document Title)",tooltip:"Text shown in the page header."}),(0,a.jsx)(b.T_,{label:"Enable Footer",checked:z,onChange:O,tooltip:"Add a repeating footer line at the bottom of every PDF page."}),z&&(0,a.jsx)(b.NL,{label:"Footer text",value:_,onChange:q,placeholder:"Footer text (e.g., Page {page} of {total})",tooltip:"Text shown in the page footer."})]}),(0,a.jsxs)(b.fN,{title:"Advanced Options",children:[(0,a.jsx)(b.T_,{label:"Enable Page Breaks",checked:R,onChange:B,tooltip:"Honor CSS page-break rules so long HTML splits across PDF pages."}),(0,a.jsx)(b.T_,{label:"Background Graphics",checked:G,onChange:W,tooltip:"Include background colors and images from the HTML in the PDF."}),(0,a.jsx)(b.T_,{label:e.htmlToPdf?.settings?.optimizeForWeb??"Optimize for Web",checked:Y,onChange:V,tooltip:y.x.optimizeForWeb})]}),(0,a.jsxs)("div",{className:"pt-4 space-y-2",children:[(0,a.jsx)(b.
58wG,{label:"Custom CSS (Optional)",tooltip:"Styles are injected into the HTML before conversion; useful for adjusting fonts, spacing, and layout.",icon:u.A}),(0,a.jsx)("textarea",{value:Z,onChange:e=>U(e.target.value),placeholder:"Add custom CSS styles for your HTML before conversion...",rows:4,className:"w-full px-3 py-2 rounded-md border border-input bg-background text-sm font-mono resize-none focus:outline-none focus:ring-2 focus:ring-primary"}),(0,a.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground flex items-center gap-1",children:[(0,a.jsx)(g.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"Very complex pages may increase processing time; start with a small sample file to validate your settings."})]})]})]});return(0,a.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 bg-background",children:[(0,a.jsx)(f.B,{config:J,labels:X,settingsPanel:er,onConvert:eo,toolName:K,toolPath:"/tools/html-to-pdf",onViewChange:e=>Q(e)}),"landing"===I&&e.htmlToPdf?.seoContent&&(0,a.jsx)(o.u,{seoContent:e.htmlToPdf.seoContent,faq:e.htmlToPdf.faq,mainHeadingLevel:"h2"})]})}},66669:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(78340).A)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]])},67514:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(78340).A)("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]])},95057:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(78340).A)("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]])}}]);
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.