Original Sentence:
${sourceText}
Translated Sentence:
${translatedText}
Note: This translation is generated by a basic client-side tool. For advanced, contextual, and idiom-aware translations, a robust server-side API is required.
`; // Set content to the hidden div if (pdfContentToPrint) { pdfContentToPrint.innerHTML = pdfContentHtml; // Trigger print window.print(); // Clear the content after printing to prevent persistent visibility issues pdfContentToPrint.innerHTML = ''; } else { console.error("PDF content div not found."); } }); } // Robust null checks for all elements if (!sourceSentenceInput || !translationDirectionSelect || !translateButton || !outputArea || !downloadPdfButton || !pdfContentToPrint) { console.error("One or more required DOM elements for the Malay Sentence Translator were not found."); } });