"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./jspdf.es.min-C518mmma.cjs"),p=require("./dom-to-png-D9eujpXB.cjs");async function P({domElement:d,fileName:l,scale:m=2,options:H={}}){if(!d)return Promise.reject("No domElement provided");const t={width:595.28,height:841.89},a=await p.domToPng({container:d,scale:m});return await new Promise((f,u)=>{const e=new window.Image;e.onload=function(){const i=e.naturalWidth,r=e.naturalHeight;let g=t.width,s=t.width/i*r;const o=new w.E("","pt","a4");let c=0,n=r;const h=i/t.width*t.height;if(n<h)o.addImage(a,"PNG",0,0,g,s,"","FAST");else for(;n>0;)o.addImage(a,"PNG",0,c,g,s,"","FAST"),n-=h,c-=t.height,n>0&&o.addPage();o.save(`${l}.pdf`),f()},e.onerror=i=>u("Failed to load image for PDF: "+i),e.src=a})}exports.default=P;
