Skip to content

Instantly share code, notes, and snippets.

@sposmen
Created August 28, 2026 21:41
Show Gist options
  • Select an option

  • Save sposmen/f2cb381abe856a8cf53acdf64ae769aa to your computer and use it in GitHub Desktop.

Select an option

Save sposmen/f2cb381abe856a8cf53acdf64ae769aa to your computer and use it in GitHub Desktop.
Weekly Print refresh page to preserve ink fresh in printer with date (print the next page to the current printed)
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Patrón de Mantenimiento - Epson ET-2800</title>
<style>
@page {
size: letter;
margin: 1cm;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.page {
height: 25cm;
page-break-after: always;
position: relative;
}
.test-line {
position: absolute;
left: 0;
right: 0;
display: flex;
align-items: center;
gap: 12px;
}
.info {
display: flex;
align-items: center;
gap: 6px;
white-space: nowrap;
}
.num {
font-weight: bold;
font-size: 14px;
color: #000;
}
.date {
font-size: 11px;
color: #555;
background-color: #eee;
padding: 2px 5px;
border-radius: 3px;
}
.bar {
height: 14px;
flex-grow: 1;
}
/* Colores puros CMYK */
.c { background-color: #00FFFF; }
.m { background-color: #FF00FF; }
.y { background-color: #FFFF00; }
.k { background-color: #000000; }
</style>
</head>
<body>
<script>
// Obtener la fecha actual en formato DD/MM/AAAA
const hoy = new Date();
const dia = String(hoy.getDate()).padStart(2, '0');
const mes = String(hoy.getMonth() + 1).padStart(2, '0');
const anio = hoy.getFullYear();
const fechaTexto = `${dia}/${mes}/${anio}`;
// Generar las 16 hojas (semanas)
for (let i = 1; i <= 18; i++) {
// Incrementa 1.5 cm la posición vertical por cada semana
let topPos = (i - 1) * 1.5;
let numFormateado = i < 10 ? '0' + i : i;
document.write(`
<div class="page">
<div class="test-line" style="top: ${topPos}cm;">
<div class="info">
<span class="num">${numFormateado}.</span>
<span class="date">${fechaTexto}</span>
</div>
<div class="bar c" title="Cian"></div>
<div class="bar m" title="Magenta"></div>
<div class="bar y" title="Amarillo"></div>
<div class="bar k" title="Negro"></div>
</div>
</div>
`);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment