Text Size: Small Medium Large
Generate Worksheet
document.getElementById(‘writing-practice-generate-button’).addEventListener(‘click’, function() { var text = document.getElementById(‘writing-practice-text-input’).value; var textSize = document.getElementById(‘writing-practice-text-size’).value; var event = new CustomEvent(‘writingPracticeGenerateWorksheet’, { detail: { text: text, textSize: textSize } }); document.dispatchEvent(event); });
This will generate single paragraphs so that students can practice printing.
If you press return, it clears the row and goes to the next paragraph.
For this reason, this does not work well for printing lists.
If you are looking to create a list with space to print. Like a list of names. We are working on that.
Preview PDF for Printing document.addEventListener(‘writingPracticeGenerateWorksheet’, function(e) { var previewArea = document.getElementById(‘writing-practice-preview’); var initialMessage = document.getElementById(‘initial-message’); if (initialMessage) { initialMessage.remove(); } var inputText = e.detail.text; var textSizeClass = ”; var totalUnderscores = 720; // 720 underscores for small font var remainingUnderscores; switch (e.detail.textSize) { case ‘small’: textSizeClass = ‘writing-practice-text-small’; remainingUnderscores = totalUnderscores - inputText.length; break; case ‘medium’: textSizeClass = ‘writing-practice-text-medium’; remainingUnderscores = totalUnderscores; // Update when number of underscores for medium is known break; case ‘large’: textSizeClass = ‘writing-practice-text-large’; remainingUnderscores = totalUnderscores; // Update when number of underscores for large is known break; } // Create the text with inputText replacing the necessary underscores var formattedText = inputText + ’_‘.repeat(remainingUnderscores); // Replace multiple spaces with non-breaking spaces and keep single spaces as normal spaces formattedText = formattedText.replace(/ +/g, function(match) { return match.split(”).join(’ ’); }); previewArea.innerHTML = '
' + formattedText + '
'; }); document.getElementById(‘preview-print-button’).addEventListener(‘click’, function() { var printContents = document.getElementById(‘writing-practice-preview-container’).innerHTML; var printStyles = ` ’) format(‘woff’); font-weight: normal; font-style: normal; } .writing-practice-text-small { font-size: 36px; font-family: ‘TeachingPrintDottedLined’, sans-serif; font-weight: bold; line-height: 48px; /* Adjust this value to control the line spacing */ } .writing-practice-text-medium { font-size: 48px; font-family: ‘TeachingPrintDottedLined’, sans-serif; font-weight: bold; } .writing-practice-text-large { font-size: 60px; font-family: ‘TeachingPrintDottedLined’, sans-serif; font-weight: bold; } .print-container { word-wrap: break-word; white-space: pre-wrap; overflow-wrap: break-word; width: 8in; /* Set width to 8 inches */ height: 10in; /* Set height to 10 inches */ padding-top: 5mm; /* Adjust top padding */ margin: 0 auto; /* Center horizontally */ display: flex; flex-direction: column; justify-content: flex-start; /* Align content to the top */ align-items: flex-start; /* Align content to the top */ /* box-sizing: border-box; Ensure padding is included in the width and height */ } .print-container div { line-height: 48px; /* Ensure the line-height matches the small font size */ height: calc(100%); /* Adjust height to fit content */ overflow: hidden; /* Hide overflow to ensure rows fit within the container */ page-break-after: always; /* Force page break after each section */ } @page { size: 8.5in 11in; margin: 0; } body { margin: 0; padding: 0; width: 100%; height: 100vh; /* Ensure the body takes the full height */ display: flex; justify-content: center; align-items: center; } `; var printWindow = document.getElementById(‘print-iframe’).contentWindow; printWindow.document.open(); printWindow.document.write(printStyles + '
' + printContents + '
'); printWindow.document.close(); printWindow.focus(); printWindow.print(); }); @font-face { font-family: ‘TeachingPrintDottedLined’; src: url(‘
https://media.mathandenglishworksheets.com/wp-content/uploads/2024/07/TeachingPrintDottedLined.woff’) format(‘woff’); font-weight: normal; font-style: normal; } .writing-practice-text-small { font-size: 36px; font-family: ‘TeachingPrintDottedLined’, sans-serif; font-weight: bold; line-height: 48px; /* Adjust this value to control the line spacing */ } .writing-practice-text-medium { font-size: 48px; font-family: ‘TeachingPrintDottedLined’, sans-serif; font-weight: bold; } .writing-practice-text-large { font-size: 60px; font-family: ‘TeachingPrintDottedLined’, sans-serif; font-weight: bold; } #writing-practice-preview { overflow: hidden; width: 800px; /* Fixed width for 40 characters */ height: 985px; /* Height to fit 18 rows */ border: 1px solid #000; /* Border around the preview */ }