How can I repeat a text string for the width of the div?
No wrapping or overflow, just truncate the string at the end.
OL Connect 2024.1 using handlebars.
This would be for microprint
I know the size of the div and the size of the font (static sized), just not the text string being used
Rather it can vary a bit, so I have different lengths.
I modified the CSS
.microprint {
font-family: Courier, monospace;
font-size: 1pt;
line-height: 1.2;
color: #000;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: flex;
align-items: center;
height: 100%; /* Ensure the div takes the full height */
}
I have it working using @microprint@, but can’t get {{microprint}} to work.
var field, result = "";
field = record.fields.microprint.toUpperCase().replace(/ /g, '\u25A0');
if (field !== "") result += field;
function generateMicroprint(field, divWidth, charWidth) {
var repeatCount = Math.floor(divWidth / (field.length * charWidth));
return field.repeat(repeatCount);
}
var divWidth = 816; // Width of the div in pixels
var charWidth = 0.5; // Estimated width of each character in pixels for 1pt Courier
var repeatedText = generateMicroprint(result, divWidth, charWidth);
results.html(repeatedText);
I forgot that this template was originally started with an older version, and even though I remember enabling handlebars, I apparently must not have save it afterwards.
The .width() will help because I have two different sized div’s.
A line of microprint on the top and bottom of the page and the signature lines in each of the 4 quadrants.
Trying to replicate the microprinting function and font from PPSv7 in OL Connect 2024.1
Are there any recommendations or adjustments you would suggest?