@flowselections/layout-maker 1.69.34 → 1.69.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/components/GeladenEtiketTab.d.ts.map +1 -1
- package/dist-lib/components/GeladenEtiketTab.js +2 -1
- package/dist-lib/components/PrintertaalKeuze.d.ts +6 -0
- package/dist-lib/components/PrintertaalKeuze.d.ts.map +1 -0
- package/dist-lib/components/PrintertaalKeuze.js +131 -0
- package/dist-lib/index.d.ts +3 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +4 -0
- package/dist-lib/integrations/supabase/types.d.ts +490 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/htmlNaarPdf.server.d.ts +2 -0
- package/dist-lib/lib/htmlNaarPdf.server.d.ts.map +1 -1
- package/dist-lib/lib/htmlNaarPdf.server.js +1 -0
- package/dist-lib/lib/htmlPdf.server.d.ts +5 -0
- package/dist-lib/lib/htmlPdf.server.d.ts.map +1 -1
- package/dist-lib/lib/htmlPdf.server.js +16 -1
- package/dist-lib/lib/printQueue.server.d.ts +1 -1
- package/dist-lib/lib/printQueue.server.d.ts.map +1 -1
- package/dist-lib/lib/printQueue.server.js +71 -11
- package/dist-lib/lib/printService.server.d.ts +20 -0
- package/dist-lib/lib/printService.server.d.ts.map +1 -1
- package/dist-lib/lib/printService.server.js +27 -0
- package/dist-lib/lib/printertaal.d.ts +49 -0
- package/dist-lib/lib/printertaal.d.ts.map +1 -0
- package/dist-lib/lib/printertaal.js +58 -0
- package/dist-lib/lib/stickerOntwerp.js +2 -2
- package/dist-lib/lib/testpagina.d.ts +2 -0
- package/dist-lib/lib/testpagina.d.ts.map +1 -1
- package/dist-lib/lib/testpagina.js +41 -16
- package/dist-lib/lib/tspl.d.ts +50 -0
- package/dist-lib/lib/tspl.d.ts.map +1 -0
- package/dist-lib/lib/tspl.js +109 -0
- package/dist-lib/lib/tsplDiagnose.functions.d.ts +58 -0
- package/dist-lib/lib/tsplDiagnose.functions.d.ts.map +1 -0
- package/dist-lib/lib/tsplDiagnose.functions.js +118 -0
- package/dist-lib/lib/tsplFont.generated.d.ts +3 -0
- package/dist-lib/lib/tsplFont.generated.d.ts.map +1 -0
- package/dist-lib/lib/tsplFont.generated.js +5 -0
- package/dist-lib/lib/tsplRaster.d.ts +33 -0
- package/dist-lib/lib/tsplRaster.d.ts.map +1 -0
- package/dist-lib/lib/tsplRaster.js +853 -0
- package/dist-lib/lib/tsplRoute.d.ts +19 -0
- package/dist-lib/lib/tsplRoute.d.ts.map +1 -0
- package/dist-lib/lib/tsplRoute.js +30 -0
- package/dist-lib/lib/versie.generated.d.ts +1 -1
- package/dist-lib/lib/versie.generated.js +1 -1
- package/dist-lib/lib/werkplekken.d.ts +3 -1
- package/dist-lib/lib/werkplekken.d.ts.map +1 -1
- package/dist-lib/lib/werkplekken.js +5 -4
- package/package.json +8 -4
- package/sql/print-schema.sql +49 -1
- package/sql/print-schema.verslag.md +3 -2
|
@@ -12,6 +12,8 @@ export interface PdfOpties {
|
|
|
12
12
|
landschap?: boolean;
|
|
13
13
|
/** Melding per weggelaten decoratie-afbeelding (zoals een logo). */
|
|
14
14
|
bijOvergeslagen?: (src: string, reden: string) => void;
|
|
15
|
+
/** 1.69.35: barcodes markeren voor de TSPL-route (alleen bij een TSPL-printer). */
|
|
16
|
+
barcodeMarkering?: boolean;
|
|
15
17
|
}
|
|
16
18
|
/** Levert de PDF als base64-tekst (zonder data:-prefix). */
|
|
17
19
|
export declare function htmlNaarPdfServer(opties: PdfOpties): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"htmlNaarPdf.server.d.ts","sourceRoot":"","sources":["../../src/lib/htmlNaarPdf.server.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAqC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,qBAAa,aAAc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AE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB1E"}
|
|
@@ -25,6 +25,7 @@ export async function htmlNaarPdfServer(opties) {
|
|
|
25
25
|
margeMm: opties.margeMm ?? 10,
|
|
26
26
|
landschap: opties.landschap ?? false,
|
|
27
27
|
bijOvergeslagen: opties.bijOvergeslagen,
|
|
28
|
+
barcodeMarkering: opties.barcodeMarkering,
|
|
28
29
|
});
|
|
29
30
|
if (!bytes.length)
|
|
30
31
|
throw new Error("De PDF is leeg gebleven.");
|
|
@@ -46,6 +46,11 @@ export interface DocumentPdfOpties {
|
|
|
46
46
|
paginanummers?: boolean;
|
|
47
47
|
/** Melding per weggelaten decoratie-afbeelding (voor het logboek). */
|
|
48
48
|
bijOvergeslagen?: (src: string, reden: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* 1.69.35: barcodes markeren (/FSBarcode) zodat de TSPL-route de modules op
|
|
51
|
+
* hele dots kan uitlijnen. Uit = PDF byte-gelijk aan eerdere versies.
|
|
52
|
+
*/
|
|
53
|
+
barcodeMarkering?: boolean;
|
|
49
54
|
}
|
|
50
55
|
export interface PdfRenderDiagnostiek {
|
|
51
56
|
geldig: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"htmlPdf.server.d.ts","sourceRoot":"","sources":["../../src/lib/htmlPdf.server.ts"],"names":[],"mappings":"AAcA,iFAAiF;AACjF,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,SAA0B;CAC/B;AACD,OAAO,
|
|
1
|
+
{"version":3,"file":"htmlPdf.server.d.ts","sourceRoot":"","sources":["../../src/lib/htmlPdf.server.ts"],"names":[],"mappings":"AAcA,iFAAiF;AACjF,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,SAA0B;CAC/B;AACD,OAAO,EAWL,KAAK,GAAG,EACT,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,EAAE,oBAAoB,CAAC;AAIpC,MAAM,WAAW,KAAK;IACpB,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sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAKD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CA8BtE;AAED,+EAA+E;AAC/E,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CA2GrF;AAmCD,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQzD"}
|
|
@@ -17,7 +17,7 @@ export class AfbeeldingInhoudFout extends Error {
|
|
|
17
17
|
this.name = "AfbeeldingInhoudFout";
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
import { PDFDocument, StandardFonts, rgb, } from "pdf-lib";
|
|
20
|
+
import { PDFDocument, PDFName, PDFOperator, PDFOperatorNames, PDFString, StandardFonts, rgb, } from "pdf-lib";
|
|
21
21
|
export const MM = 2.834645669291339; // punten per millimeter
|
|
22
22
|
const LEEG = new Set(["img", "br", "hr", "col", "meta", "link", "input"]);
|
|
23
23
|
function decodeer(t) {
|
|
@@ -1087,6 +1087,15 @@ function tekenBarcode(tk, waarde, x, breedte, hoogte, yBoven) {
|
|
|
1087
1087
|
return;
|
|
1088
1088
|
const boven = yBoven ?? tk.y;
|
|
1089
1089
|
const y = boven - hoogte;
|
|
1090
|
+
// 1.69.35: markering voor de TSPL-route (tsplRaster lijnt de modules op hele
|
|
1091
|
+
// dots uit). PDF-viewers en printerdrivers negeren gemarkeerde inhoud.
|
|
1092
|
+
const pg = tk.pagina;
|
|
1093
|
+
const markeer = MARKEER.has(pg.doc);
|
|
1094
|
+
if (markeer)
|
|
1095
|
+
pg.pushOperators(PDFOperator.of(PDFOperatorNames.BeginMarkedContentSequence, [
|
|
1096
|
+
PDFName.of("FSBarcode"),
|
|
1097
|
+
pg.doc.context.obj({ P: PDFString.of(patroon), X: x, Y: y, W: breedte, H: hoogte }),
|
|
1098
|
+
]));
|
|
1090
1099
|
let start = 0;
|
|
1091
1100
|
let zwart = patroon[0] === "1";
|
|
1092
1101
|
for (let i = 1; i <= patroon.length; i += 1) {
|
|
@@ -1105,6 +1114,8 @@ function tekenBarcode(tk, waarde, x, breedte, hoogte, yBoven) {
|
|
|
1105
1114
|
zwart = huidig;
|
|
1106
1115
|
}
|
|
1107
1116
|
}
|
|
1117
|
+
if (markeer)
|
|
1118
|
+
pg.pushOperators(PDFOperator.of(PDFOperatorNames.EndMarkedContent));
|
|
1108
1119
|
}
|
|
1109
1120
|
/** Leest alleen expliciet door de renderer aangeleverde barcodewaarden. */
|
|
1110
1121
|
function zoekBarcodeWaarde(n) {
|
|
@@ -1344,6 +1355,8 @@ async function laadAfbeeldingen(pdf, wortel) {
|
|
|
1344
1355
|
(inhoud.has(src) ? inhoudFouten : overgeslagen).set(src, r);
|
|
1345
1356
|
return { beelden, fouten: inhoudFouten, overgeslagen };
|
|
1346
1357
|
}
|
|
1358
|
+
/** PDF's waarin barcodes gemarkeerd worden (alleen voor de TSPL-route). */
|
|
1359
|
+
const MARKEER = new WeakSet();
|
|
1347
1360
|
/**
|
|
1348
1361
|
* Bewaakt constructies die de eigen PDF-motor niet hetzelfde kan uitleggen als
|
|
1349
1362
|
* een browser. @page is toegestaan: papier en marge komen uit de canonieke
|
|
@@ -1405,6 +1418,8 @@ export async function htmlNaarPdfBytes(opties) {
|
|
|
1405
1418
|
const breedte = (opties.landschap ? Math.max(bMm, hMm) : Math.min(bMm, hMm)) * MM;
|
|
1406
1419
|
const hoogte = (opties.landschap ? Math.min(bMm, hMm) : Math.max(bMm, hMm)) * MM;
|
|
1407
1420
|
const pdf = await PDFDocument.create();
|
|
1421
|
+
if (opties.barcodeMarkering)
|
|
1422
|
+
MARKEER.add(pdf);
|
|
1408
1423
|
const normaal = await pdf.embedFont(StandardFonts.Helvetica);
|
|
1409
1424
|
const vet = await pdf.embedFont(StandardFonts.HelveticaBold);
|
|
1410
1425
|
const wortel = ontleedHtml(opties.html);
|
|
@@ -113,7 +113,7 @@ export declare function wachtOpLayout(db: PrintDb, job: Job, reden: string): Pro
|
|
|
113
113
|
* proberen kan niet slagen, dus meteen een eindstatus: telt niet als wachtend
|
|
114
114
|
* en valt buiten "Alles annuleren". De foutcode bepaalt het label.
|
|
115
115
|
*/
|
|
116
|
-
export declare function geweigerd(db: PrintDb, job: Job, code: "FORMAAT_PAST_NIET" | "GEEN_GELADEN_ETIKET" | "PAPIER_STAND_WIJKT_AF" | "PAST_NIET_OP_ETIKET", bericht: string): Promise<void>;
|
|
116
|
+
export declare function geweigerd(db: PrintDb, job: Job, code: "FORMAAT_PAST_NIET" | "GEEN_GELADEN_ETIKET" | "PAPIER_STAND_WIJKT_AF" | "PAST_NIET_OP_ETIKET" | "PRINTERTAAL_ONGELDIG" | "TSPL_NIET_MOGELIJK", bericht: string): Promise<void>;
|
|
117
117
|
/** Koper wil deze sticker niet: eindstatus zonder fout en zonder nieuwe poging. */
|
|
118
118
|
export declare function nietNodig(db: PrintDb, job: Job): Promise<void>;
|
|
119
119
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printQueue.server.d.ts","sourceRoot":"","sources":["../../src/lib/printQueue.server.ts"],"names":[],"mappings":"AAQA,OAAO,EAA0C,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGjG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA2B5D,OAAO,EAA+H,KAAK,gBAAgB,EAAkF,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"printQueue.server.d.ts","sourceRoot":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"}
|
|
@@ -21,7 +21,10 @@ import { controlelijstHtml, EIGEN_STICKER_MAAT_ONBEKEND, VOORBEELD_TRAY_PAYLOAD,
|
|
|
21
21
|
import { neemCodelijstMeldingen, startCodelijstRonde, stopCodelijstRonde } from "./codelijstCache.js";
|
|
22
22
|
import { kiesFormaat, testprintHoudtFormaat } from "./kiesFormaat.js";
|
|
23
23
|
import { OPMAAK_LIMIET_MS, OpmaakTeLangFout, metTijdslimiet } from "./opmaakLimiet.js";
|
|
24
|
-
import { stuurPdfNaarPrinter, opdrachtStatusDetail, vervaltijdVoor } from "./printService.server.js";
|
|
24
|
+
import { stuurPdfNaarPrinter, stuurRawNaarPrinter, rawAanvraag, opdrachtStatusDetail, vervaltijdVoor } from "./printService.server.js";
|
|
25
|
+
import { leesPrintertaal } from "./printertaal.js";
|
|
26
|
+
import { maakTsplUitPdf } from "./tsplRoute.js";
|
|
27
|
+
import { kopieenVoorPrinter as kopieenVoorTspl } from "./stickerFormaat.js";
|
|
25
28
|
import { kiesPapier } from "./papierFormaten.js";
|
|
26
29
|
import { waaromDezePrinter } from "./waaromPrinter.js";
|
|
27
30
|
import { etiketPast, leesGeladenEtiket, maatNl, pdfPaginaMm } from "./etiketControle.js";
|
|
@@ -1861,12 +1864,16 @@ async function verwerkJob(db, job) {
|
|
|
1861
1864
|
const formaat = kiesFormaat(job, layout);
|
|
1862
1865
|
const liggend = String(formaat.orientatie ?? "portrait") === "landscape";
|
|
1863
1866
|
const gewoneMarge = Number(testprintHoudtFormaat(job) ? (vf?.["marge_boven"] ?? 10) : (layout?.marge_boven ?? vf?.["marge_boven"] ?? 10));
|
|
1867
|
+
// 1.69.35: alleen bij een TSPL-printer barcodes markeren; PDF-route blijft byte-gelijk.
|
|
1868
|
+
const tsplTaal = leesPrintertaal(printer["printertaal_instellingen"]);
|
|
1869
|
+
const tsplPrinter = tsplTaal.ok && tsplTaal.printertaal === "tspl";
|
|
1864
1870
|
const maak = (breedteMm, hoogteMm, landschap, margeMm) => htmlNaarPdfServer({
|
|
1865
1871
|
html,
|
|
1866
1872
|
breedteMm,
|
|
1867
1873
|
hoogteMm,
|
|
1868
1874
|
margeMm,
|
|
1869
1875
|
landschap,
|
|
1876
|
+
barcodeMarkering: tsplPrinter,
|
|
1870
1877
|
bijOvergeslagen: (src, reden) => {
|
|
1871
1878
|
void faseLog(db, job.id, "afbeelding_weggelaten", { bron: src.split("?")[0]?.slice(0, 200), reden });
|
|
1872
1879
|
},
|
|
@@ -1975,6 +1982,50 @@ async function verwerkJob(db, job) {
|
|
|
1975
1982
|
}
|
|
1976
1983
|
}
|
|
1977
1984
|
const verloopt = vervaltijdVoor(String(job.documenttype ?? ""));
|
|
1985
|
+
// 1.69.35: printertaal van de printer die echt print. "pdf" = gedrag 1.69.26.
|
|
1986
|
+
const taal = leesPrintertaal(doelPrinter["printertaal_instellingen"]);
|
|
1987
|
+
if (!taal.ok) {
|
|
1988
|
+
await geweigerd(db, job, "PRINTERTAAL_ONGELDIG", taal.bericht);
|
|
1989
|
+
return "mislukt";
|
|
1990
|
+
}
|
|
1991
|
+
let tsplBase64 = null;
|
|
1992
|
+
if (taal.printertaal === "tspl") {
|
|
1993
|
+
const etiket = doelPrinter === printer ? labelPagina : null;
|
|
1994
|
+
if (!etiket) {
|
|
1995
|
+
await geweigerd(db, job, "TSPL_NIET_MOGELIJK", "Deze printer staat op TSPL, maar er is geen geladen etiket bekend. Vul bij de printer het geladen etiket in.");
|
|
1996
|
+
return "mislukt";
|
|
1997
|
+
}
|
|
1998
|
+
const aantal = kopieenVoorTspl(kopieenNaarPrinter, String(job.documenttype ?? ""));
|
|
1999
|
+
const t = await maakTsplUitPdf(pdfBase64, etiket, taal.tspl, aantal);
|
|
2000
|
+
if (!t.ok) {
|
|
2001
|
+
await geweigerd(db, job, t.code, t.bericht);
|
|
2002
|
+
return "mislukt";
|
|
2003
|
+
}
|
|
2004
|
+
tsplBase64 = t.base64;
|
|
2005
|
+
const { content: _c, ...aanvraag } = rawAanvraag({ externPrinterId: String(doelPrinter.extern_printer_id), jobId: String(job.id), expireAfter: verloopt, documentnaam: String(job.documentnaam ?? "Document"), rawBase64: "" });
|
|
2006
|
+
void _c;
|
|
2007
|
+
await faseLog(db, job.id, "tspl_opdracht", {
|
|
2008
|
+
route: "tspl",
|
|
2009
|
+
size: t.opdracht.kop.size,
|
|
2010
|
+
gap: t.opdracht.kop.gap,
|
|
2011
|
+
direction: t.opdracht.kop.direction,
|
|
2012
|
+
dpi: t.opdracht.kop.dpi,
|
|
2013
|
+
bitmap_breedte_dots: t.opdracht.bitmap.breedte_dots,
|
|
2014
|
+
bitmap_hoogte_dots: t.opdracht.bitmap.hoogte_dots,
|
|
2015
|
+
paginas: t.opdracht.paginas,
|
|
2016
|
+
pagina_maten_mm: t.raster.maten_mm.map((m) => [Math.round(m.breedte_mm * 10) / 10, Math.round(m.hoogte_mm * 10) / 10]),
|
|
2017
|
+
aantal: t.opdracht.aantal,
|
|
2018
|
+
tekst_vergroot_tot_6pt: t.meldingen.tekst_vergroot,
|
|
2019
|
+
tekst_ingekort: t.meldingen.tekst_ingekort ?? 0,
|
|
2020
|
+
tekst_weggelaten: t.meldingen.tekst_weggelaten ?? 0,
|
|
2021
|
+
barcodes: t.meldingen.barcodes,
|
|
2022
|
+
opdracht_tekst: t.opdracht.tekst,
|
|
2023
|
+
aanvraag,
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
else {
|
|
2027
|
+
await faseLog(db, job.id, "route", { route: "pdf", paginas: await pdfPaginaAantal(pdfBase64).catch(() => null), aantal: kopieenNaarPrinter });
|
|
2028
|
+
}
|
|
1978
2029
|
// Eén fysieke printer via meerdere computers: probeer de routes op
|
|
1979
2030
|
// volgorde; valt de eerste weg, dan automatisch de volgende.
|
|
1980
2031
|
const routes = await printerRoutes(db, String(doelPrinter.id), String(doelPrinter.extern_printer_id));
|
|
@@ -1982,16 +2033,25 @@ async function verwerkJob(db, job) {
|
|
|
1982
2033
|
let laatsteFout = null;
|
|
1983
2034
|
for (const [i, route] of routes.entries()) {
|
|
1984
2035
|
try {
|
|
1985
|
-
externJobId =
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2036
|
+
externJobId = tsplBase64 != null
|
|
2037
|
+
? await stuurRawNaarPrinter({
|
|
2038
|
+
jobId: String(job.id),
|
|
2039
|
+
expireAfter: verloopt,
|
|
2040
|
+
externPrinterId: route.extern,
|
|
2041
|
+
documentnaam: String(job.documentnaam ?? "Document"),
|
|
2042
|
+
rawBase64: tsplBase64,
|
|
2043
|
+
})
|
|
2044
|
+
: await stuurPdfNaarPrinter({
|
|
2045
|
+
jobId: String(job.id),
|
|
2046
|
+
expireAfter: verloopt,
|
|
2047
|
+
externPrinterId: route.extern,
|
|
2048
|
+
documentnaam: String(job.documentnaam ?? "Document"),
|
|
2049
|
+
pdfBase64,
|
|
2050
|
+
kopieen: kopieenNaarPrinter,
|
|
2051
|
+
documenttype: String(job.documenttype ?? ""),
|
|
2052
|
+
opties: { paper: papier.paper, rotate: papier.rotate, fitToPage },
|
|
2053
|
+
});
|
|
2054
|
+
await faseLog(db, job.id, "printnode_verstuurd", { route: tsplBase64 != null ? "tspl" : "pdf", extern_job_id: externJobId, api_aanroepen: i + 1 });
|
|
1995
2055
|
if (i > 0) {
|
|
1996
2056
|
await log(db, job.id, "route", `Verstuurd via computer ${route.computer ?? "andere route"}: de eerste computer was niet bereikbaar.`);
|
|
1997
2057
|
}
|
|
@@ -58,6 +58,26 @@ export declare function haalPrinterFormaten(externPrinterId: string): Promise<{
|
|
|
58
58
|
}>;
|
|
59
59
|
/** Stuurt een PDF rechtstreeks naar de printer. Geeft het externe opdrachtnummer terug. */
|
|
60
60
|
export declare function stuurPdfNaarPrinter(input: PrintOpdrachtInput): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* 1.69.35: ruwe printertaal (TSPL) naar de printer. Geen paper, rotate,
|
|
63
|
+
* fit_to_page of dpi: de opdracht zelf bevat SIZE/GAP. qty is altijd 1; het
|
|
64
|
+
* aantal staat in PRINT n,1. Zelfde idempotentiesleutel (print_jobs.id).
|
|
65
|
+
*/
|
|
66
|
+
export declare function stuurRawNaarPrinter(input: {
|
|
67
|
+
externPrinterId: string;
|
|
68
|
+
jobId?: string | null;
|
|
69
|
+
expireAfter?: number | null;
|
|
70
|
+
documentnaam: string;
|
|
71
|
+
rawBase64: string;
|
|
72
|
+
}): Promise<string>;
|
|
73
|
+
/** De PrintNode-aanvraag voor ruwe inhoud (zuiver, ook voor de diagnose). */
|
|
74
|
+
export declare function rawAanvraag(input: {
|
|
75
|
+
externPrinterId: string;
|
|
76
|
+
jobId?: string | null;
|
|
77
|
+
expireAfter?: number | null;
|
|
78
|
+
documentnaam: string;
|
|
79
|
+
rawBase64: string;
|
|
80
|
+
}): Record<string, unknown>;
|
|
61
81
|
/**
|
|
62
82
|
* Zoekt een PrintNode-opdracht op exact `source` (bevat print_jobs.id).
|
|
63
83
|
* De lijst staat nieuwste eerst; we bladeren hooguit een paar pagina's.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printService.server.d.ts","sourceRoot":"","sources":["../../src/lib/printService.server.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IAC1C,oDAAoD;IACpD,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACt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AAc,CAAC,CAejF;AAED,yCAAyC;AACzC,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAGpD;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,qDAAqD;AACrD,wBAAsB,aAAa,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAchE"}
|
|
@@ -136,6 +136,33 @@ export async function stuurPdfNaarPrinter(input) {
|
|
|
136
136
|
if (typeof input.expireAfter === "number" && input.expireAfter > 0) {
|
|
137
137
|
body["expireAfter"] = Math.round(input.expireAfter);
|
|
138
138
|
}
|
|
139
|
+
return verstuurAanvraag(body, input.jobId);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* 1.69.35: ruwe printertaal (TSPL) naar de printer. Geen paper, rotate,
|
|
143
|
+
* fit_to_page of dpi: de opdracht zelf bevat SIZE/GAP. qty is altijd 1; het
|
|
144
|
+
* aantal staat in PRINT n,1. Zelfde idempotentiesleutel (print_jobs.id).
|
|
145
|
+
*/
|
|
146
|
+
export async function stuurRawNaarPrinter(input) {
|
|
147
|
+
return verstuurAanvraag(rawAanvraag(input), input.jobId);
|
|
148
|
+
}
|
|
149
|
+
/** De PrintNode-aanvraag voor ruwe inhoud (zuiver, ook voor de diagnose). */
|
|
150
|
+
export function rawAanvraag(input) {
|
|
151
|
+
const body = {
|
|
152
|
+
printerId: Number(input.externPrinterId),
|
|
153
|
+
title: input.documentnaam.slice(0, 120),
|
|
154
|
+
contentType: "raw_base64",
|
|
155
|
+
content: input.rawBase64,
|
|
156
|
+
source: sourceVoorJob(input.jobId ?? undefined),
|
|
157
|
+
qty: 1,
|
|
158
|
+
options: {},
|
|
159
|
+
};
|
|
160
|
+
if (typeof input.expireAfter === "number" && input.expireAfter > 0)
|
|
161
|
+
body["expireAfter"] = Math.round(input.expireAfter);
|
|
162
|
+
return body;
|
|
163
|
+
}
|
|
164
|
+
async function verstuurAanvraag(body, jobId) {
|
|
165
|
+
const input = { jobId };
|
|
139
166
|
const headers = {};
|
|
140
167
|
if (input.jobId)
|
|
141
168
|
headers["X-Idempotency-Key"] = input.jobId;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const printertaalSchema: z.ZodObject<{
|
|
3
|
+
printertaal: z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
pdf: "pdf";
|
|
5
|
+
tspl: "tspl";
|
|
6
|
+
}>>;
|
|
7
|
+
dpi: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<203>, z.ZodLiteral<300>]>>;
|
|
8
|
+
gap_mm: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
gap_offset_mm: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
direction: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
11
|
+
verschuiving_x_mm: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
verschuiving_y_mm: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
speed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
14
|
+
density: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type PrintertaalInvoer = z.infer<typeof printertaalSchema>;
|
|
17
|
+
export interface TsplInstellingen {
|
|
18
|
+
printertaal: "tspl";
|
|
19
|
+
dpi: 203 | 300;
|
|
20
|
+
gap_mm: number;
|
|
21
|
+
gap_offset_mm: number;
|
|
22
|
+
direction: 0 | 1;
|
|
23
|
+
verschuiving_x_mm: number;
|
|
24
|
+
verschuiving_y_mm: number;
|
|
25
|
+
speed: number | null;
|
|
26
|
+
density: number | null;
|
|
27
|
+
}
|
|
28
|
+
export type PrintertaalUitkomst = {
|
|
29
|
+
ok: true;
|
|
30
|
+
printertaal: "pdf";
|
|
31
|
+
} | {
|
|
32
|
+
ok: true;
|
|
33
|
+
printertaal: "tspl";
|
|
34
|
+
tspl: TsplInstellingen;
|
|
35
|
+
} | {
|
|
36
|
+
ok: false;
|
|
37
|
+
bericht: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const TSPL_STANDAARD: {
|
|
40
|
+
dpi: 203;
|
|
41
|
+
gap_mm: number;
|
|
42
|
+
gap_offset_mm: number;
|
|
43
|
+
direction: 1;
|
|
44
|
+
verschuiving_x_mm: number;
|
|
45
|
+
verschuiving_y_mm: number;
|
|
46
|
+
};
|
|
47
|
+
/** Leest de instellingen van een printerrij; {} of null = PDF. */
|
|
48
|
+
export declare function leesPrintertaal(waarde: unknown): PrintertaalUitkomst;
|
|
49
|
+
//# sourceMappingURL=printertaal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printertaal.d.ts","sourceRoot":"","sources":["../../src/lib/printertaal.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;kBAYnB,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,KAAK,CAAA;CAAE,GAChC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,GACzD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,eAAO,MAAM,cAAc;;;;;;;CAO1B,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CAwBpE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/printertaal.ts — 1.69.35: printertaal per printer (PDF of TSPL).
|
|
3
|
+
// Bron: printers.printertaal_instellingen (jsonb). Leeg = "pdf" (gedrag 1.69.26).
|
|
4
|
+
// Ongeldige waarden = weigering met reden (fail closed), nooit een stille
|
|
5
|
+
// terugval. Maat, stand en marge komen NIET hiervandaan maar uit
|
|
6
|
+
// bepaalLabelPagina (labelPagina.ts).
|
|
7
|
+
// ============================================================================
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
const getal = (min, max) => z.number().finite().min(min).max(max);
|
|
10
|
+
export const printertaalSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
printertaal: z.enum(["pdf", "tspl"]).optional(),
|
|
13
|
+
dpi: z.union([z.literal(203), z.literal(300)]).optional(),
|
|
14
|
+
gap_mm: getal(0, 20).optional(),
|
|
15
|
+
gap_offset_mm: getal(0, 20).optional(),
|
|
16
|
+
direction: z.union([z.literal(0), z.literal(1)]).optional(),
|
|
17
|
+
verschuiving_x_mm: getal(-20, 20).optional(),
|
|
18
|
+
verschuiving_y_mm: getal(-20, 20).optional(),
|
|
19
|
+
speed: getal(1, 18).nullable().optional(),
|
|
20
|
+
density: z.number().int().min(0).max(15).nullable().optional(),
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
export const TSPL_STANDAARD = {
|
|
24
|
+
dpi: 203,
|
|
25
|
+
gap_mm: 3,
|
|
26
|
+
gap_offset_mm: 0,
|
|
27
|
+
direction: 1,
|
|
28
|
+
verschuiving_x_mm: 0,
|
|
29
|
+
verschuiving_y_mm: 0,
|
|
30
|
+
};
|
|
31
|
+
/** Leest de instellingen van een printerrij; {} of null = PDF. */
|
|
32
|
+
export function leesPrintertaal(waarde) {
|
|
33
|
+
if (waarde == null)
|
|
34
|
+
return { ok: true, printertaal: "pdf" };
|
|
35
|
+
const r = printertaalSchema.safeParse(waarde);
|
|
36
|
+
if (!r.success) {
|
|
37
|
+
const veld = r.error.issues[0]?.path.join(".") || "instelling";
|
|
38
|
+
return { ok: false, bericht: `De printertaal-instelling '${veld}' is ongeldig; controleer de printerinstellingen.` };
|
|
39
|
+
}
|
|
40
|
+
const v = r.data;
|
|
41
|
+
if ((v.printertaal ?? "pdf") === "pdf")
|
|
42
|
+
return { ok: true, printertaal: "pdf" };
|
|
43
|
+
return {
|
|
44
|
+
ok: true,
|
|
45
|
+
printertaal: "tspl",
|
|
46
|
+
tspl: {
|
|
47
|
+
printertaal: "tspl",
|
|
48
|
+
dpi: v.dpi ?? TSPL_STANDAARD.dpi,
|
|
49
|
+
gap_mm: v.gap_mm ?? TSPL_STANDAARD.gap_mm,
|
|
50
|
+
gap_offset_mm: v.gap_offset_mm ?? TSPL_STANDAARD.gap_offset_mm,
|
|
51
|
+
direction: v.direction ?? TSPL_STANDAARD.direction,
|
|
52
|
+
verschuiving_x_mm: v.verschuiving_x_mm ?? 0,
|
|
53
|
+
verschuiving_y_mm: v.verschuiving_y_mm ?? 0,
|
|
54
|
+
speed: v.speed ?? null,
|
|
55
|
+
density: v.density ?? null,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -104,6 +104,6 @@ export function stickerOntwerpHtml(g, velden, maat, bedrijf = {}) {
|
|
|
104
104
|
if (aan.has("fust") && (g.fust_nummer || g.fust_totaal))
|
|
105
105
|
delen.push(`<div class="fust">Fust ${esc(g.fust_nummer)} van ${esc(g.fust_totaal)}</div>`);
|
|
106
106
|
if (aan.has("barcode") && g.barcode)
|
|
107
|
-
delen.push(`<div class="bc">${code128BarsHtml(g.barcode)}</div><div class="bct">${esc(g.barcode)}</div>`);
|
|
108
|
-
return `<!doctype html><html><head><meta charset="utf-8"><style>@page{size:${b}mm ${h}mm;margin:0}html,body{margin:0;padding:0}body{width:${b}mm;height:${h}mm;box-sizing:border-box;padding:1.5mm 2mm;font:${pt}pt Arial,sans-serif;overflow:hidden
|
|
107
|
+
delen.push(`<div class="bc" data-barcode="${esc(g.barcode)}" style="height:${bcHoogte}mm">${code128BarsHtml(g.barcode)}</div><div class="bct">${esc(g.barcode)}</div>`);
|
|
108
|
+
return `<!doctype html><html><head><meta charset="utf-8"><style>@page{size:${b}mm ${h}mm;margin:0}html,body{margin:0;padding:0}body{width:${b}mm;height:${h}mm;box-sizing:border-box;padding:1.5mm 2mm;font:${pt}pt Arial,sans-serif;overflow:hidden}.kop{display:flex;align-items:center;gap:2mm;margin-bottom:1mm}.logo{max-height:${Math.min(12, h * 0.12)}mm;max-width:35mm}.bn{font-weight:bold}.r{line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fust{font-weight:bold;font-size:${pt + 2}pt;margin:0.5mm 0}.bc{display:flex;height:${bcHoogte}mm;margin-top:1mm}.bct{text-align:center;font-size:${Math.max(5, pt - 1.5)}pt}</style></head><body>${delen.join("")}</body></html>`;
|
|
109
109
|
}
|
|
@@ -24,6 +24,8 @@ export interface TestpaginaInvoer {
|
|
|
24
24
|
dpi: number | null;
|
|
25
25
|
code: string;
|
|
26
26
|
datum: string;
|
|
27
|
+
/** 1.69.35: route van de printer; TSPL = minimaal 6 pt tekst. */
|
|
28
|
+
route?: "PDF" | "TSPL";
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* HTML van de testpagina op een etiket van B × H mm (puur, voor tests).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testpagina.d.ts","sourceRoot":"","sources":["../../src/lib/testpagina.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"testpagina.d.ts","sourceRoot":"","sources":["../../src/lib/testpagina.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAGvF,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CAAC;IACjC,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAC,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;KAAE,CAAC;CAC5G;AACD,eAAO,MAAM,aAAa,EAAE,aAK3B,CAAC;AAOF,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,GAAG,GAAE,MAAM,MAAoB,GAAG,MAAM,CAKhE;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAIxD;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC,CAAC;IAC7E,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAuF/D;AAoBD,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAEnF;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI,GACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6ExB"}
|
|
@@ -16,6 +16,7 @@ import { printHtml, volgJobStatus } from "./printApi.js";
|
|
|
16
16
|
import { supabase } from "./supabaseClient.js";
|
|
17
17
|
import { tekstBreedtePt, regelHoogtePt } from "./fontMetrics.js";
|
|
18
18
|
import { bepaalLabelPagina, lijktLabelprinter } from "./labelPagina.js";
|
|
19
|
+
import { leesPrintertaal } from "./printertaal.js";
|
|
19
20
|
export const testpaginaAfh = {
|
|
20
21
|
db: supabase,
|
|
21
22
|
printHtml,
|
|
@@ -61,10 +62,15 @@ export function testpaginaRolHtml(inv) {
|
|
|
61
62
|
blok(0, H - L, d, L);
|
|
62
63
|
blok(B - L, H - d, L, d);
|
|
63
64
|
blok(B - d, H - L, d, L);
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
// 1.69.35: pijl "BOVEN" aan de bovenrand (zie je hem onderaan, dan staat
|
|
66
|
+
// DIRECTION verkeerd). Geen kruis meer in het midden: dat viel over de tekst.
|
|
67
|
+
const pijlH = Math.max(1.6, Math.min(3, H * 0.09));
|
|
68
|
+
const px = m + 1.2;
|
|
69
|
+
for (let i = 0; i < 4; i++) {
|
|
70
|
+
const w = 0.4 + i * (pijlH / 2.2);
|
|
71
|
+
blok(px + pijlH / 1.6 - w / 2, m + 0.5 + (i * pijlH) / 5, w, pijlH / 5);
|
|
72
|
+
}
|
|
73
|
+
blok(px + pijlH / 1.6 - 0.25, m + 0.5 + (4 * pijlH) / 5, 0.5, pijlH * 0.6);
|
|
68
74
|
// mm-streepjes om de 5 mm langs boven- en linkerkant (binnen de rand).
|
|
69
75
|
for (let x = 5; x < B - 2; x += 5)
|
|
70
76
|
blok(x - 0.1, m, 0.2, x % 10 === 0 ? 1.5 : 1);
|
|
@@ -72,26 +78,44 @@ export function testpaginaRolHtml(inv) {
|
|
|
72
78
|
blok(m, y - 0.1, y % 10 === 0 ? 1.5 : 1, 0.2);
|
|
73
79
|
// Tekstblok, gecentreerd binnen de rand.
|
|
74
80
|
const kort = Math.min(B, H);
|
|
75
|
-
const
|
|
81
|
+
const minPt = inv.route === "TSPL" ? 6 : 3;
|
|
82
|
+
const basis = Math.max(inv.route === "TSPL" ? 6.5 : 5, Math.min(11, 0.22 * kort));
|
|
76
83
|
const maxBreedteMm = B - 2 * m - 2;
|
|
77
84
|
const dpiTekst = inv.dpi ? `${inv.dpi} dpi` : "203 dpi aangenomen";
|
|
78
85
|
const alle = [
|
|
79
|
-
{ tekst: "TESTPAGINA", pt: basis, vet: true, sleutel: "titel" },
|
|
86
|
+
{ tekst: "BOVEN · TESTPAGINA", pt: basis, vet: true, sleutel: "titel" },
|
|
80
87
|
{ tekst: inv.printerNaam, pt: basis * 0.9, vet: false, sleutel: "naam" },
|
|
81
88
|
{ tekst: `${nl(B)} × ${nl(H)} mm · ${dpiTekst} · ${inv.pagina.paper ?? "geen driverpapier"}`, pt: basis * 0.75, vet: false, sleutel: "maat" },
|
|
89
|
+
{ tekst: `Rand ${nl(B - 2 * m)} × ${nl(H - 2 * m)} mm${inv.route ? ` · ${inv.route}` : ""}`, pt: basis * 0.75, vet: false, sleutel: "rand" },
|
|
82
90
|
{ tekst: inv.code, pt: basis * 1.2, vet: true, sleutel: "code" },
|
|
83
91
|
{ tekst: inv.datum, pt: basis * 0.75, vet: false, sleutel: "datum" },
|
|
84
92
|
];
|
|
85
93
|
const pas = (r) => {
|
|
86
|
-
let pt = r.pt;
|
|
87
|
-
while (pt >
|
|
94
|
+
let pt = Math.max(minPt, r.pt);
|
|
95
|
+
while (pt > minPt && tekstBreedtePt(r.tekst, pt, r.vet) * PT_MM > maxBreedteMm)
|
|
88
96
|
pt -= 0.25;
|
|
89
|
-
|
|
97
|
+
// Titel, printernaam en code vallen nooit weg: op de minimale grootte nog te breed → inkorten met "…".
|
|
98
|
+
let tekst = r.tekst;
|
|
99
|
+
// De dpi-regel eerst korter maken (driverpapier eraf, dan alleen de dpi) voordat hij wegvalt.
|
|
100
|
+
if (r.sleutel === "maat") {
|
|
101
|
+
for (const k of [tekst, `${nl(B)} × ${nl(H)} mm · ${dpiTekst}`, dpiTekst]) {
|
|
102
|
+
tekst = k;
|
|
103
|
+
if (tekstBreedtePt(k, pt, r.vet) * PT_MM <= maxBreedteMm)
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (["titel", "naam", "code"].includes(r.sleutel)) {
|
|
108
|
+
while (tekst.length > 3 && tekstBreedtePt(tekst, pt, r.vet) * PT_MM > maxBreedteMm)
|
|
109
|
+
tekst = tekst.slice(0, -2) + "…";
|
|
110
|
+
}
|
|
111
|
+
return { ...r, tekst, pt };
|
|
90
112
|
};
|
|
91
113
|
let regels = alle.map(pas);
|
|
92
114
|
const hoogteVan = (rs) => rs.reduce((t, r) => t + regelHoogtePt(r.pt) * PT_MM, 0);
|
|
93
115
|
const beschikbaar = H - 2 * m - 1;
|
|
94
|
-
|
|
116
|
+
// Regels die op de minimale grootte nog te breed zijn vallen weg (titel/naam/code nooit).
|
|
117
|
+
regels = regels.filter((r) => ["titel", "naam", "code"].includes(r.sleutel) || tekstBreedtePt(r.tekst, r.pt, r.vet) * PT_MM <= maxBreedteMm);
|
|
118
|
+
for (const weg of ["datum", "maat", "rand"]) {
|
|
95
119
|
if (hoogteVan(regels) <= beschikbaar)
|
|
96
120
|
break;
|
|
97
121
|
regels = regels.filter((r) => r.sleutel !== weg);
|
|
@@ -146,11 +170,10 @@ export async function drukTestpaginaAf(printerId, naam, sleutel, bijKlaar) {
|
|
|
146
170
|
};
|
|
147
171
|
let printer = null;
|
|
148
172
|
try {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
.eq("id", printerId)
|
|
153
|
-
.maybeSingle();
|
|
173
|
+
const velden = "geladen_etiket, papierformaat, ondersteunde_formaten, rol_invoerrichting, rol_marge_mm, naam, weergavenaam, soort";
|
|
174
|
+
let { data, error } = await testpaginaAfh.db.from("printers").select(`${velden}, printertaal_instellingen`).eq("id", printerId).maybeSingle();
|
|
175
|
+
if (error)
|
|
176
|
+
({ data } = await testpaginaAfh.db.from("printers").select(velden).eq("id", printerId).maybeSingle());
|
|
154
177
|
printer = data ?? null;
|
|
155
178
|
}
|
|
156
179
|
catch {
|
|
@@ -171,7 +194,9 @@ export async function drukTestpaginaAf(printerId, naam, sleutel, bijKlaar) {
|
|
|
171
194
|
klaar("mislukt");
|
|
172
195
|
return null;
|
|
173
196
|
}
|
|
174
|
-
|
|
197
|
+
const taal = leesPrintertaal(printer?.["printertaal_instellingen"]);
|
|
198
|
+
const tspl = taal.ok && taal.printertaal === "tspl" ? taal.tspl : null;
|
|
199
|
+
html = testpaginaRolHtml({ route: tspl ? "TSPL" : "PDF", printerNaam: weergave, pagina: u, dpi: tspl ? tspl.dpi : dpiUitFormaten(printer?.["ondersteunde_formaten"]), code, datum });
|
|
175
200
|
voorbeeld = { breedte_mm: u.breedte_mm, hoogte_mm: u.hoogte_mm, orientatie: u.breedte_mm > u.hoogte_mm ? "landscape" : "portrait", marge_boven: 0 };
|
|
176
201
|
maatTekst = ` (etiket ${nl(u.breedte_mm)} × ${nl(u.hoogte_mm)} mm, code ${code})`;
|
|
177
202
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TsplInstellingen } from "./printertaal.js";
|
|
2
|
+
export declare const CRLF = "\r\n";
|
|
3
|
+
/** mm → dots. */
|
|
4
|
+
export declare function mmNaarDots(mm: number, dpi: number): number;
|
|
5
|
+
/** Breedte in dots, naar boven afgerond op een veelvoud van 8 (hele bytes). */
|
|
6
|
+
export declare function breedteDots(mm: number, dpi: number): number;
|
|
7
|
+
/** Eén zwart-witbeeld: 1 = zwart, 0 = wit, rij voor rij (breedte = veelvoud van 8). */
|
|
8
|
+
export interface Raster {
|
|
9
|
+
breedte: number;
|
|
10
|
+
hoogte: number;
|
|
11
|
+
dots: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
export declare function nieuwRaster(breedte: number, hoogte: number): Raster;
|
|
14
|
+
/** Packt naar TSPL-BITMAP-bytes: bit 0 = zwart, 1 = wit. */
|
|
15
|
+
export declare function rasterNaarBitmap(r: Raster): Uint8Array;
|
|
16
|
+
/** Verschuift een raster (negatieve x/y: de inhoud schuift zelf, BITMAP blijft op 0). */
|
|
17
|
+
export declare function verschuif(r: Raster, dx: number, dy: number): Raster;
|
|
18
|
+
export interface TsplPagina {
|
|
19
|
+
raster: Raster;
|
|
20
|
+
}
|
|
21
|
+
export interface TsplOpdracht {
|
|
22
|
+
bytes: Uint8Array;
|
|
23
|
+
/** Leesbare tekst zonder bitmapdata ("BITMAP x,y,b,h,0,<n bytes>"). */
|
|
24
|
+
tekst: string;
|
|
25
|
+
kop: {
|
|
26
|
+
size: string;
|
|
27
|
+
gap: string;
|
|
28
|
+
direction: string;
|
|
29
|
+
dpi: number;
|
|
30
|
+
};
|
|
31
|
+
bitmap: {
|
|
32
|
+
breedte_dots: number;
|
|
33
|
+
hoogte_dots: number;
|
|
34
|
+
bytes_per_pagina: number;
|
|
35
|
+
};
|
|
36
|
+
paginas: number;
|
|
37
|
+
aantal: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Bouwt de opdracht. Elke pagina = eigen CLS … BITMAP … PRINT aantal,1-blok.
|
|
41
|
+
* Het aantal staat alleen in PRINT (PrintNode qty blijft 1).
|
|
42
|
+
*/
|
|
43
|
+
export declare function bouwTsplOpdracht(paginas: TsplPagina[], maat: {
|
|
44
|
+
breedte_mm: number;
|
|
45
|
+
hoogte_mm: number;
|
|
46
|
+
}, inst: TsplInstellingen, aantal: number): TsplOpdracht;
|
|
47
|
+
/** Alleen op uitdrukkelijk verzoek (knop met bevestiging): voert een paar etiketten door. */
|
|
48
|
+
export declare function gapdetectOpdracht(): Uint8Array;
|
|
49
|
+
export declare function bytesNaarBase64(bytes: Uint8Array): string;
|
|
50
|
+
//# sourceMappingURL=tspl.d.ts.map
|