diff --git a/tests/artwork_browser_test.mjs b/tests/artwork_browser_test.mjs
index 374e622..befc2bf 100644
--- a/tests/artwork_browser_test.mjs
+++ b/tests/artwork_browser_test.mjs
@@ -319,10 +319,14 @@ try{
const m=result.pos[0].m;
return !m.bits[2*m.cw+2] && !m.bits[2*m.cw+30] && !!m.bits[15*m.cw+30];
})()`),true);
- // A real finished sheet keeps its own dimensions and by-metre price.
+ // A real finished sheet keeps its own width and by-metre price. Its 19 cm
+ // without ink at the bottom are cut, but for 0,5 cm (Marcus, 2026-11-18);
+ // the 0,7 cm at the top stay, under the 1 cm the cut starts at.
await click('#bVoltar');await click('[data-modo="file"]');
await evaluate('sendSheet()');
- await waitFor(()=>evaluate('folhas.length===1 && !!folhas[0].previewSrc && metros===0.342'),'ready-sheet image');
+ await waitFor(()=>evaluate(`folhas.length===1 && !!folhas[0].previewSrc && folhas[0].med.alt>34 && folhas[0].corte?.topo===0 &&
+ folhas[0].corte.fim>18 && Math.abs(metros-(folhas[0].med.alt-folhas[0].corte.fim)/100)<0.0001`),'ready-sheet image, trimmed');
+ assert.equal(await evaluate(`$('lista').textContent.includes('cm vazios do fim do arquivo. Cobrado: 1,00 m.')`),true);
// On its way at once, with its own row under the uploader (Dropstar,
// 2026-10-29). There is no storage here, so it fails, and says so with a
// way to try again; tests/browser_test.mjs sends it for real.
diff --git a/web/site-cart.js b/web/site-cart.js
index 59eba79..b65b311 100644
--- a/web/site-cart.js
+++ b/web/site-cart.js
@@ -297,7 +297,9 @@ function carrinho(){
const sources=(ehFolha()?folhas:artes).map(x=>ehFolha()
? {kind:'sheet',width_cm:x.med?.larg||larguraFilme(),length_cm:+(x.m*100).toFixed(4),
copies:x.rep||1,rotation_degrees:0,mirrored:false,
- measurement:x.med?'file':'customer'}
+ measurement:x.med?'file':'customer',
+ // The empty strips cut from the top and the bottom (aplicaCorte).
+ ...(x.corte?{trim_top_cm:x.corte.topo,trim_bottom_cm:x.corte.fim}:{})}
: fonteDaArte(x));
let layout, partes=null;
if(ehFolha()){
diff --git a/web/site-pdf.js b/web/site-pdf.js
index cf2bb97..691e5d3 100644
--- a/web/site-pdf.js
+++ b/web/site-pdf.js
@@ -531,6 +531,15 @@ function detalhesDaFolha(a,i,aberto){
'Ver o que o Prumo conferiu'+
linhas.map(l=>''+l+'').join('')+'';
}
+// What the empty strips cut from a sheet were (aplicaCorte, Marcus 18/11/2026):
+// with one sheet the line says what is charged; with several the total is
+// rounded once, so it says what this sheet counts.
+function textoCorte(x, sozinha){
+ const {topo, fim}=x.corte;
+ const onde=topo&&fim ? 'do começo e do fim' : topo ? 'do começo' : 'do fim';
+ return 'Removemos '+Math.round(topo+fim)+' cm vazios '+onde+' do arquivo. '+
+ (sozinha ? 'Cobrado: '+fmtM(cobrar(x.m))+' m.' : 'Esta folha fica com '+fmtM(x.m)+' m.');
+}
function pintaFolha(){
if(!MODOS[modo]) return; // read after the customer left the product page
invalidaItemAtual();
@@ -549,6 +558,7 @@ function pintaFolha(){
if(lido){
medida='
'+n1(x.med.larg)+' × '+n1(x.med.alt)+' cm'+
''+escapeHTML(extDe(x.f.name))+' · '+fmt(x.f.size)+'
'+
+ (x.corte? ''+textoCorte(x, folhas.length===1 && (x.rep||1)===1)+'
' : '')+
(a? ''+chipsDaFolha(a,residuoAceito(x))+'
'+avisosDaFolha(a,x.f.name,i,residuoAceito(x),true)+
(temAvisoFolha(x)?ajusteLinha(i,'data-ajuste'):'')+
detalhesDaFolha(a,i,x.detAberto) : '')+
diff --git a/web/site-quality.js b/web/site-quality.js
index 52394d4..76a823b 100644
--- a/web/site-quality.js
+++ b/web/site-quality.js
@@ -64,9 +64,17 @@ function tracoDoItem(lista,layout){
const fino=medidas.reduce((a,b)=>b.traco.pxx.mistaVista && mista(lista?tracoDaArte(x):tracoDoArquivo(x)));
+ // On a sheet with its empty strips cut (aplicaCorte) the stroke's place
+ // counts from where the cut starts, as the printed film does.
+ let fracao=fino.traco.proofYFraction||0;
+ const doArquivo=!lista && arquivos[fino.index];
+ if(doArquivo && doArquivo.corte && doArquivo.med){
+ const {topo,fim}=doArquivo.corte, alt=doArquivo.med.alt;
+ fracao=Math.max(0,Math.min(1,(fracao*alt-topo)/(alt-topo-fim)));
+ }
return {strokePx:fino.traco.px, strokeClass:fino.traco.classe, strokeChoice:avisado?'measured':null,
proofSourceIndex:fino.index,
- proofYFraction:fracaoNoFilme(layout||montagemLayout,fino.index,fino.traco.proofYFraction||0)};
+ proofYFraction:fracaoNoFilme(layout||montagemLayout,fino.index,fracao)};
}
// Fecha a medida da conferência quando não há mais arquivo sendo lido (0.12).
function marcaTempos(){
diff --git a/web/site-sheet.js b/web/site-sheet.js
index b75ad29..2ea0812 100644
--- a/web/site-sheet.js
+++ b/web/site-sheet.js
@@ -304,7 +304,13 @@ function analisarMapa(m){
porPerto.forEach(set=>{ if(set.size>1) encostadas+=set.size; });
const total=m.wPx*m.hPx;
+ // As faixas sem tinta no começo e no fim da folha (Marcus, 18/11/2026): cada
+ // célula guarda onde a tinta começa e termina, em pixels do mapa.
+ let topo=m.hPx, fim=-1;
+ for(let p=0;pfim) fim=m.y1[p]; }
return {
+ vazioTopoCm: fim<0 ? 0 : topo/m.pxPorCm,
+ vazioFimCm: fim<0 ? 0 : (m.hPx-1-fim)/m.pxPorCm,
dpi: Math.round(m.wPx/(m.larguraCm/2.54)),
artes: ilhas.length-residuos.length,
residuos: residuos.length,
diff --git a/web/site-upload.js b/web/site-upload.js
index 55d6a18..d60d71f 100644
--- a/web/site-upload.js
+++ b/web/site-upload.js
@@ -61,6 +61,19 @@ I.addEventListener('change',()=>sel([...I.files]));
// Each file's upload, under the uploader (Dropstar, 2026-10-29): the bytes
// sent of its size, then the security check; a failure says why. It starts
// as soon as the file is on the page (checkout.js sends it).
+// Faixas vazias no começo e no fim de uma folha pronta em PNG saem do preço e
+// da impressão (Marcus, 18/11/2026). Fica 0,5 cm de margem, como na montagem,
+// e só se corta faixa de mais de 1 cm. O servidor imprime só o que sobra.
+const CORTE_MARGEM_CM=0.5, CORTE_MINIMO_CM=1;
+function aplicaCorte(x){
+ x.corte=null;
+ if(!x.med||!x.an||!/\.png$/i.test(x.f.name)) return;
+ const corta=v=>v>CORTE_MINIMO_CM ? +(v-CORTE_MARGEM_CM).toFixed(2) : 0;
+ const topo=corta(x.an.vazioTopoCm||0), fim=corta(x.an.vazioFimCm||0);
+ if(!(topo||fim) || topo+fim>=x.med.alt) { x.m=x.med.alt/100; return; }
+ x.corte={topo, fim};
+ x.m=+((x.med.alt-topo-fim)/100).toFixed(4);
+}
const ENVIADO_MS=4000;
const enviadoEm=new WeakMap();
// A few repaints a second, page in view or not: progress comes in far more often.
@@ -165,7 +178,7 @@ async function sel(fs){
// On their way at once; a JPG is refused at the order anyway.
fs.filter(f=>!/\.jpe?g$/i.test(f.name)).forEach(f=>window.dtfEnvio?.enviar(f));
if(ehFolha()){
- const novas=fs.map(f=>({f, med:null, rep:1, m:0, semAnalise:null, analiseInicio:Date.now()}));
+ const novas=fs.map(f=>({f, med:null, rep:1, m:0, corte:null, semAnalise:null, analiseInicio:Date.now()}));
folhas=folhas.concat(novas); // soma, não substitui
pintaFolha();
novas.forEach(x=>{
@@ -202,6 +215,7 @@ async function sel(fs){
try{
const an=analisarMapa(lido.mapa);
x.an={...an, dpi:md.dpiFolha, fonteDpi:'arquivo', grande:false};
+ aplicaCorte(x);
}catch(e){
if(md.tall){x.an=null;x.measurementError='Não foi possível conferir este PNG alto. Divida a folha em partes menores antes de pagar.';}
}
@@ -224,7 +238,7 @@ async function sel(fs){
try{ x.an={...analisarMapa(await mapaDaImagem(fonte, md.larg, p=>{
const pct=80+Math.floor(p*19);
if(pct>mostrado){ mostrado=pct; x.pct=pct; pintaProgressoFolha(x); }
- })), fonteDpi:'arquivo'}; }catch(e){}
+ })), fonteDpi:'arquivo'}; aplicaCorte(x); }catch(e){}
if(fonte.close) fonte.close();
}
x.pct=null; pintaFolha(); marcaResiduos(x);