Governing Law: This Agreement shall be governed by the laws of **${data.jurisdiction}**.
`;
}
function trfLoadExample() {
if(!confirm("Overwrite current fields with example data?")) return;
document.getElementById('inp-company').value = "GlobalTech Solutions LLC";
document.getElementById('inp-grantor').value = "Alex Smith";
document.getElementById('inp-title').value = "Head of Development";
document.getElementById('inp-media').value = "Video";
document.getElementById('inp-term').value = "3Year";
document.getElementById('inp-comp').value = "250.00";
document.getElementById('inp-jurisdiction').value = "California, USA";
document.getElementById('inp-limit').value = "Use restricted only to B2B marketing channels and industry case studies. Cannot be used on public consumer review sites.";
trfUpdatePreview();
trfSwitchTab('preview');
}
// --- PDF Generation ---
async function trfGeneratePDF() {
trfUpdatePreview(); // Ensure latest data
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
const paperContent = document.getElementById('trf-preview-paper');
// PDF margins
const margin = 50;
const pageWidth = doc.internal.pageSize.getWidth();
const contentWidth = pageWidth - (margin * 2);
// Reconstruct text content to ensure clean, selectable text in PDF
const data = trfGetData();
doc.setFont("times", "bold");
doc.setFontSize(16);
doc.setTextColor(0, 0, 0);
doc.text("TESTIMONIAL AND MEDIA RELEASE AGREEMENT", pageWidth / 2, 40, { align: 'center' });
let y = 60;
// Section 1: Parties
doc.setFontSize(11);
doc.setFont("times", "normal");
const p1 = `This Agreement is made on ${data.dateStr}. Parties: This agreement is between ${data.grantor} ("Grantor"), with the affiliation ${data.title}, and ${data.company} ("Grantee").`;
const splitP1 = doc.splitTextToSize(p1, contentWidth);
doc.text(splitP1, margin, y);
y += (splitP1.length * 14) + 10;
// Section 2: Rights
doc.setFont("times", "bold");
doc.text("1. Grant of Rights:", margin, y); y += 6;
doc.setFont("times", "normal");
const mediaText = `The Grantor hereby irrevocably grants to the Grantee, and its successors and assigns, the absolute right and permission to use, publish, and republish the Grantor's ${data.media} in all forms of media.`;
const splitMedia = doc.splitTextToSize(mediaText, contentWidth);
doc.text(splitMedia, margin, y);
y += (splitMedia.length * 14) + 10;
// Section 3: Scope and Term
doc.setFont("times", "bold");
doc.text("2. Scope and Term:", margin, y); y += 6;
doc.setFont("times", "normal");
const termText = `The Grantee may use the released media globally for the term ${data.term}. The Grantor waives any right to inspect or approve the finished product.`;
const splitTerm = doc.splitTextToSize(termText, contentWidth);
doc.text(splitTerm, margin, y);
y += (splitTerm.length * 14) + 10;
// Section 4: Compensation
doc.setFont("times", "bold");
doc.text("3. Compensation:", margin, y); y += 6;
doc.setFont("times", "normal");
const compText = `In full consideration of all rights granted herein, the Grantee agrees to pay the Grantor the sum of ${data.compStr}, the receipt and sufficiency of which is hereby acknowledged.`;
const splitComp = doc.splitTextToSize(compText, contentWidth);
doc.text(splitComp, margin, y);
y += (splitComp.length * 14) + 10;
// Section 5: Limitation
doc.setFont("times", "bold");
doc.text("4. Specific Limitation:", margin, y); y += 6;
doc.setFont("times", "normal");
const limitText = `The Grantee agrees that use shall be limited to the following restrictions: ${data.limit}`;
const splitLimit = doc.splitTextToSize(limitText, contentWidth);
doc.text(splitLimit, margin, y);
y += (splitLimit.length * 14) + 40;
// Signature Block
doc.setFont("times", "bold");
doc.text("IN WITNESS WHEREOF, the parties execute this agreement:", margin, y); y += 30;
// Grantor Signature
doc.setDrawColor(0);
doc.line(margin, y, margin + 150, y);
doc.setFont("times", "normal");
doc.text("Grantor Signature", margin, y + 10);
doc.text(`Printed Name: ${data.grantor}`, margin, y + 25);
// Grantee Signature
doc.line(margin + 250, y, margin + 400, y);
doc.text(`For Grantee (${data.company})`, margin + 250, y + 10);
doc.text("Printed Name: Authorized Representative", margin + 250, y + 25);
doc.save(`Release_Form_${data.grantor.replace(/\s/g, '_')}.pdf`);
}