Subpoena Generator
Create and generate a formal subpoena for documents or testimony.
Case Information
TO (Name and Address of Recipient)
Command to Appear and/or Produce
Information for Issuing Attorney/Party
Generating your PDF, please wait...
Location: ${commandLocation}
Date: ${commandDate}
Time: ${commandTime}
DOCUMENTS, INFORMATION, OR OBJECTS TO BE PRODUCED
- ${documentsRequested}
Failure to appear or produce the documents as commanded may subject you to penalties for contempt of court.
ISSUING PARTY
${attorneyName} (Bar #${barNumber})
${firmName}
${attorneyAddress}
${attorneyPhone}
Date: ${new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
Signature of Issuing Attorney
`; subpoenaPreview.innerHTML = html; }; window.changeTab = (tabIndex) => { currentTab = tabIndex; updateTabUI(); }; prevBtn.addEventListener('click', () => { if (currentTab > 0) { currentTab--; updateTabUI(); } }); nextBtn.addEventListener('click', () => { if (currentTab < tabs.length - 1) { currentTab++; updateTabUI(); } }); downloadPdfBtn.addEventListener('click', async () => { if (!window.jspdf || !window.html2canvas) { alert('PDF generation library is not loaded.'); return; } loader.classList.remove('hidden'); downloadPdfBtn.disabled = true; try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(subpoenaPreview, { scale: 2 }); const pdf = new jsPDF('p', 'mm', 'a4'); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgWidth = canvas.width; const imgHeight = canvas.height; const ratio = imgWidth / imgHeight; const imgHeightInPdf = pdfWidth / ratio; let position = 0; let heightLeft = imgHeightInPdf; pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 10, 10, pdfWidth - 20, imgHeightInPdf - 20); heightLeft -= (pdf.internal.pageSize.getHeight() - 20); while (heightLeft > 0) { position -= (pdf.internal.pageSize.getHeight() - 20); pdf.addPage(); pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 10, position, pdfWidth - 20, imgHeightInPdf - 20); heightLeft -= (pdf.internal.pageSize.getHeight() - 20); } pdf.save('Subpoena.pdf'); } catch (error) { console.error("PDF Generation Error:", error); alert("An error occurred while generating the PDF. Please try again."); } finally { loader.classList.add('hidden'); downloadPdfBtn.disabled = false; } }); updateTabUI(); });