Kurz gesagt
Ein Faltblatt für eine Kartenausstellung, bereit für die Druckerei. Es zeigt, wie man zusätzlichen Raum über den Seitenrand hinaus und Schnittmarken anlegt und ein PDF in den Farben der Druckmaschinen speichert.
Was Sie setzen
Das Saalblatt für Cartografías imaginarias, eine erfundene Ausstellung mit Karten erfundener Orte, so wie es in die Druckerei geht, in beiden Ausgaben dieser Seite auf Spanisch. Jede Seite von 170 × 227 mm liegt auf einem um 22 mm größeren Blatt, das Anschnitt und Schnittmarken enthält. Auf dem Umschlag kreuzt eine orange Route einen Archipel in abgestuften Grüntönen und läuft über das Endformat hinaus in den Anschnitt. Innen öffnen sich vier Säle in Karla im Flattersatz unter Wegpunkt-Dachzeilen, und ein oranger Reiter führt die Pagina über den Außenrand hinaus; die Rückseite setzt einen Grundriss über ein Band aus Relief. Der Pen exportiert die Druckdatei, ein PDF/X-4, separiert für FOGRA51 (die Bedingung PSO Coated v3 des gestrichenen Papiers mit 150 g), mit Schriften, Lesezeichen und Seitenbezeichnungen, dazu einen Graustufenproof, und führt den Preflight am Layout aus, bevor er sie anbietet. In der Druckdatei kommen die Karten und der Grundriss aus Druckvorlagen in handverlesenen Farbaufbauten, und Schrift, Reiter und Wegpunktringe verwenden dieselben Farben über eine in CMYK angelegte Palette.
Dieses Rezept beantwortet
- Wie erstelle ich ein druckfertiges PDF mit Anschnitt, Schnittmarken, Lesezeichen, Seitenbeschriftungen und einem Farbraum?
- Wie exportiere ich im Browser ein echtes PDF mit eingebetteten Schriften?
- Wie füge ich auf jeder Seite ein Wasserzeichen, eine Hintergrundtönung oder ein Schmuckbild ein?
Die kurze Antwort
const BLEED = 3; // mm of artwork past the trim: the cover, the tab and the back band reach it
// Hook-up: config().page.cutLines. A mark starts markOffset outside the trim (3 mm by default)
// and never inside the bleed, and runs 5 mm (markLength). Each page grows by doc.trimOffset
// a side, bleed + offset + mark: 11 mm here.
const cutLines = { enabled: true, bleed: mm(BLEED) };
// Hook-up: config().print. PDF/X-4 for the press on FOGRA51 (PSO Coated v3, the leaflet's
// 150 g coated matte): every colour separated through the profile (the authored ones as
// written), 100 % K text overprinting, the output intent, TrimBox and BleedBox on each page.
// The 7.5 pt bold labels in forest hold in four inks on coated stock: the small-text check
// starts at 7 pt instead of 9.
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51', preflight: { smallTextSize: pt(7) } };
// Where the profiles are fetched from: postext.dev serves postext's icc/ folder at /icc/ (any
// copy of it works, and so does the npm CDN's postext/icc/).
const PROFILES = 'https://postext.dev/icc/';
// `masters` holds print-master bytes by fileId (section 2 writes them). The proof is an
// ordinary greyscale PDF: no PDF/X, which would force CMYK.
function pressPdf(doc, kind, masters) {
const press = kind === 'press';
return renderToPdf(doc, {
fontProvider: fontsourceProvider, // Fontsource's files; TrueType faces are subset
// The press file takes config().print, its profile fetched from PROFILES
// (outputProfile: the .icc bytes, to hand it over yourself).
profileBaseUrl: PROFILES,
...(press ? {} : { print: { standard: 'none' }, colorSpace: 'grayscale' }),
// renderToPdf asks for a drawing's master (svg.pdfFileId) first, then for its SVG. The
// proof answers the SVG only, which its grey conversion can reach; a master stays in CMYK.
resourceBytes: (fileId) => (press && masters.get(fileId)) || imageBytes(fileId),
}); // bookmarks (from the headings) and /PageLabels (from the folios) come by default
}
Zutaten
- Funktionen
- Anschnitt und SchnittmarkenPDFs in CMYK und GraustufenDruckvorlagen für SVGPDF-ExportIm PDF eingebettete SchriftenPDF-LesezeichenAnschnittbänder und DaumenregisterGestaltungselemente verankernBilder in SeitengestaltungenKopfzeilen nach SeitenrolleKolumnentitel je AbschnittÜberschriftenformateUmschläge, Titelseiten und ImpressumGestaltete AuftakteÜberschriftenattributeDokument-MetadatenKolumnentitel und SeitenzahlenAbbildungen und Tabellen als RessourcenAbbildung und Tabelle in Ihrer SpracheSemantische Farbpalette
- Nutzt außerdem
- Verweise, die Abbildungen platzierenNummerierte ÜberschriftenAbsatzformateEigene RessourcentypenAbschnittsgeometrieKapitel ohne Nummer
- Schrift
- Karla, Space Grotesk, Space Mono (SIL OFL 1.1)
- Dateien
- Keine: Jedes Bild wird im Code gezeichnet
Zubereitung
#1 · Bildschirmfarben nach ihren Druckplatten wählen
const palette = {
ink: '#161616', // text: a neutral grey prints on the black plate alone (K95 on FOGRA51)
muted: '#666666', // the running heads, on black alone for the same reason (K66)
forest: '#0b3d2e', // the sea, the kickers, the back band
signal: '#ff6626', // route, waypoints, tab
sage: '#9fb8a8', // high ground; small type on forest
paper: '#f4f1ea', // type on forest: reversed out, it prints no ink at all
};
// The colours authored in CMYK (%), the same builds as the print masters (section 2), so the
// type, the tab and the drawings share their inks. Without them the profile would separate
// the forest as C90 M43 Y71 K62 and the orange as C0 M70 Y90 K0, a shade off the route.
const AUTHORED = { forest: [100, 45, 80, 55], signal: [0, 60, 85, 0], sage: [40, 20, 35, 0],
paper: [0, 0, 0, 0] };
const cmyk = ([c, m, y, k]) => ({ c, m, y, k });
const value = (id) => (AUTHORED[id]
? { hex: palette[id], model: 'cmyk', cmyk: cmyk(AUTHORED[id]) }
: { hex: palette[id], model: 'hex' });
// col(id): a palette-linked colour: the hex for the screen and, where authored, its build.
const col = (id) => ({ ...value(id), paletteId: id });
const colorPalette = [
...Object.keys(palette).map((id) => ({ id, name: id, value: value(id) })),
// The engine's defaults link to 'main-color': point it at the forest, so nothing prints blue.
{ id: 'main-color', name: 'forest (defaults)', value: { hex: palette.forest, model: 'hex' } },
];
print: { standard: 'pdfx4', outputProfile: 'fogra51' } in der Konfiguration separiert jede Farbe über das FOGRA51-Profil, das mit postext ausgeliefert wird. Neutrale Grautöne drucken allein auf der Schwarzplatte, ihr K so gewählt, dass der Ton passt: #161616 wird zu K95 und das #666666 der Kolumnentitel zu K66, und Text in 100 % K überdruckt. Das Profil separierte das Waldgrün als C90 M43 Y71 K62 und das Orange als C0 M70 Y90 K0, eine Nuance neben der Route der Druckvorlagen (Schritt 5), deshalb sind diese beiden, das Salbeigrün und die Papierfarbe in CMYK angelegt: ColorValue.cmyk enthält den Farbaufbau, der Hexwert bleibt für den Bildschirm, und jede mit der Palette verknüpfte Verwendung gibt den Aufbau so aus, wie er notiert ist. Die Papierfarbe ist C0 M0 Y0 K0: Schrift, die aus dem Waldgrün ausgespart ist, druckt keine Farbe, sodass keine Platte sie verschieben kann.
#2 · Ein Daumenregister, das die Schneidemaschine übersteht
const TAB = { w: 10, h: 24 }; // the tab as it will be trimmed, mm; its foot is level with the text
const tab = (parity) => {
const edge = parity === 'even' ? 'bottom-left' : 'bottom-right'; // the fore-edge
const from = (to, y) => ({ anchor: { to, edge }, offset: { y: mm(y) } });
return [
// The box hangs from the bleed frame and BLEED of its width is trimmed off, so a cut that
// lands a millimetre outside the trim still leaves orange at the edge.
{ kind: 'box', id: `tab-${parity}`, style: { backgroundColor: col('signal') },
placement: { ...from('bleed', -(FOOT + BLEED)), size: { width: mm(TAB.w + BLEED),
height: mm(TAB.h) } } },
// The folio hangs from the trim frame ('page'), so it centres on the part left after the cut.
{ kind: 'text', id: `folio-${parity}`, content: '{pageNumber}', ...label, align: 'center',
fontSize: pt(11), letterSpacing: pt(0), color: col('ink'),
placement: { ...from('page', -FOOT), size: { width: mm(TAB.w), height: mm(TAB.h) } } },
].map((element) => ({ ...element, parity, pages: 'body' })); // never on the covers
};
const head = (parity, content) => ({ kind: 'text', id: `head-${parity}`, content, ...label,
color: col('muted'), parity, pages: 'body',
placement: { anchor: { to: 'container', edge: parity === 'even' ? 'top-left' : 'top-right' },
offset: { y: mm(11) } } });
const header = { elements: [head('even', '{title}'), head('odd', '{subtitle}')] };
const footer = { elements: [...tab('even'), ...tab('odd')] };
Der Kasten des Reiters hängt am Rahmen des Anschnitts und ist um BLEED breiter als der fertige Reiter, sodass ein Schnitt, der einen Millimeter außerhalb des Endformats liegt, am Rand trotzdem Orange lässt; die Pagina hängt am Rahmen der Seite, also am Endformat, und zentriert sich auf den verbleibenden 10 mm. parity wählt die Seiten, auf denen ein Element erscheint, und edge wechselt mit, um den Außenrand zu erreichen, während pages: 'body' den Reiter und die Kolumnentitel ({title} und {subtitle} aus dem Frontmatter) von beiden Umschlagseiten fernhält, die als Auftaktseiten zählen, weil jede mit einer Überschrift beginnt, die über die ganze Seitenbreite reicht oder auf eine neue Seite umbricht. Jedes Element der Kopf- oder Fußzeile wiederholt sich auf diese Weise, sodass ein image mit parity und pages ein Wasserzeichen oder ein Schmuckbild auf jede Seite setzt; Kopf- und Fußzeilen werden über den Text gemalt, und eine Tönung dahinter gehört in page.backgroundColor.
#3 · Bilder bis in den Anschnitt, Schrift innerhalb des Endformats
const BAND = 44; // mm from the trim foot to the top of the back band
const onForest = { color: col('paper'), align: 'left', overflow: 'wrap' };
const art = (resourceId, edge) => ({ kind: 'image', id: resourceId, resourceId,
placement: { anchor: { to: 'bleed', edge }, size: { width: 'fill' } } }); // height: its ratio
// The map is as tall as the sheet and the cover reserves down to its foot, so the lead
// starts on page 2. span: 'page' makes the cover an opener, so furniture set to
// pages: 'body' skips it.
const cover = { id: 'cover', numbered: false, span: 'page', advancedDesign: { enabled: true,
slot: { elements: [ // paint order: the map first, the type on top
art('cubierta', 'top-left'),
{ kind: 'text', id: 'kicker', content: '{attr.kicker}', ...label, color: col('sage'),
placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { y: mm(6) } } },
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: 'Space Grotesk',
fontWeight: 700, fontSize: pt(50), lineHeight: 0.98, ...onForest,
placement: { anchor: { to: '#kicker', edge: 'below' }, offset: { y: mm(4) },
size: { width: mm(132) } } },
{ kind: 'text', id: 'subtitle', content: '{subtitle}', fontFamily: 'Karla', fontSize: pt(13),
...onForest, placement: { anchor: { to: '#title', edge: 'below' }, offset: { y: mm(5) } } },
] } },
footer: { elements: [ // the cover's own foot: dates and place, over open sea
{ kind: 'text', id: 'dates', content: '{attr.fechas}', ...label, color: col('paper'),
placement: { anchor: { to: 'container', edge: 'bottom-left' }, offset: { y: mm(-15) } } },
{ kind: 'text', id: 'place', content: '{attr.lugar}', ...label, color: col('sage'),
placement: { anchor: { to: '#dates', edge: 'below' }, offset: { y: mm(1.6) } } },
] } };
const back = { id: 'back', numbered: false, breakBefore: { enabled: true, parity: 'any' },
advancedDesign: room('{attr.kicker}'),
margins: { bottom: mm(BAND + 8) }, // the text stops 8 mm above the band
footer: { elements: [
art('banda', 'bottom-left'),
{ kind: 'text', id: 'venue', content: '{attr.lugar}', fontFamily: 'Space Grotesk',
fontWeight: 700, fontSize: pt(20), ...onForest, // on the band, level with the text edge
placement: { anchor: { to: '#banda', edge: 'align-top' }, offset: { x: mm(BLEED + OUTER),
y: mm(6) } } },
{ kind: 'text', id: 'address', content: '{attr.direccion}', fontFamily: 'Karla',
fontSize: pt(10), ...onForest,
placement: { anchor: { to: '#venue', edge: 'below' }, offset: { y: mm(1.5) } } },
{ kind: 'text', id: 'when', content: '{attr.fechas}', ...label, color: col('sage'),
placement: { anchor: { to: '#address', edge: 'below' }, offset: { y: mm(4) } } },
{ kind: 'text', id: 'colophon', content: '{attr.colofon}', ...label, fontWeight: 400,
// 6.3 pt in sage would be three inks on a four-ink band: reversed to paper, it prints
// no ink and no plate can shift it (the preflight's small-text check).
fontSize: pt(6.3), letterSpacing: pt(0), textTransform: 'none', lineHeight: 1.4,
color: col('paper'), overflow: 'wrap',
placement: { anchor: { to: 'page', edge: 'bottom-left' }, offset: { x: mm(OUTER),
y: mm(-6) }, size: { width: mm(78) } } }, // 57 monospaced characters a line
] } };
cutLines fügt an jeder Kante der Seite Anschnitt, Markenabstand und die 5-mm-Marke hinzu, hier 11 mm. Der Abstand beträgt standardmäßig 3 mm, so viel wie dieser Anschnitt, deshalb beginnen die Marken an der Kante des Anschnitts und laufen nach außen; bei einem breiteren Anschnitt begännen sie weiterhin an seiner Kante, nie innerhalb. Ein Bildelement, das mit width: 'fill' am Anschnitt verankert ist, nimmt die Breite dieses Rahmens an und behält seine eigenen Proportionen: Die Umschlagkarte ist in 176 × 233 mm gezeichnet, dem Endformat plus 3 mm je Seite, sodass sie die Kante des Anschnitts erreicht, wo die Schnittmarken beginnen, während die Schrift am Satzspiegel hängt, deutlich innerhalb des Endformats. Die Rückseite ist ein Überschriftenstil, dessen Fußzeile die des Dokuments ersetzt, mit einem Band aus demselben Generator, verankert am Fuß des Anschnitts, und einem unteren Rand, der den Text 8 mm darüber enden lässt.
#4 · Überschriften, die zu Lesezeichen werden
headings: {
// A designed heading keeps its own text, hidden, for the bookmarks and the tags. Set it in
// a face the pages already load, or the PDF embeds Open Sans for that text alone.
fontFamily: 'Space Grotesk',
levels: [
// Rooms follow on: the H1's page break is off. The back cover breaks through its style,
// and the front one fills its page. The template numbers kicker and bookmark: "Sala 1
// Una isla en ninguna parte".
{ level: 1, numberingTemplate: 'Sala {1}', breakBefore: { enabled: false },
marginTop: pt(LEAD), advancedDesign: room('{number} · {attr.fecha}') },
],
},
renderToPdf baut die Lesezeichen aus den Überschriften, deshalb ist jeder Saal eine Überschrift der Ebene 1, die ohne Seitenumbruch folgt, und numberingTemplate gibt der Dachzeile ihre {number} und dem Lesezeichen sein Präfix: Das PDF listet den Umschlag, „Sala 1 Una isla en ninguna parte“ bis „Sala 4 La isla del tesoro“ und die praktischen Hinweise. Eine gestaltete Überschrift verbirgt ihren eigenen Text, behält ihn aber für Lesezeichen und Tags; ohne fontFamily wird dieser verborgene Text in Open Sans 700 gesetzt, die die Seiten laden und das PDF allein für diesen Text einbetten würde. Die Seitenbezeichnungen folgen page.pageNumbering, das hier auf dem Standardwert bleibt: dezimal ab 1, sodass Seite 3 in einem PDF-Betrachter die Seite ist, deren Reiter 3 zeigt.
#5 · Druckvorlagen in exakten Farben
// C, M, Y, K in %, one build per colour of the drawings, matched to the screen colours on a
// proof. The palette authors forest, signal, sage and paper with these same builds, so the
// route matches the tab and the kickers match the sea.
const INKS = { forest: [100, 45, 80, 55], shallows: [100, 50, 85, 40], coast: [90, 50, 85, 20],
lowland: [80, 40, 75, 5], upland: [50, 15, 45, 20], sage: [40, 20, 35, 0],
summit: [10, 5, 10, 0], tint: [5, 0, 5, 5], signal: [0, 60, 85, 0], paper: [0, 0, 0, 0] };
function pdfPage(w, h, shapes) { // w, h in mm; the content stream flips y to match the SVG
const s = 72 / 25.4; // pt per mm
const ink = (id, op) => `${INKS[id].map((v) => v / 100).join(' ')} ${op}`;
const ops = (d) => d.replace(/([MLCZ])([^MLCZ]*)/g,
(_, c, v) => `${v.trim()} ${{ M: 'm', L: 'l', C: 'c', Z: 'h' }[c]} `.trimStart());
const body = shapes.map(({ d, fill, stroke, width, dash }) => [
'q', fill && ink(fill, 'k'), stroke && ink(stroke, 'K'), stroke && `${width} w 1 J 1 j`,
dash && `[${dash.join(' ')}] 0 d`, ops(d), fill ? 'f' : 'S', 'Q',
].filter(Boolean).join(' ')).join('\n');
const stream = `${s} 0 0 ${-s} 0 ${h * s} cm\n${body}`;
const objects = ['<< /Type /Catalog /Pages 2 0 R >>', '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',
`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${n(w * s)} ${n(h * s)}] /Contents 4 0 R >>`,
`<< /Length ${stream.length} >>\nstream\n${stream}\nendstream`];
let pdf = '%PDF-1.4\n';
const offsets = objects.map((object, i) => {
const offset = pdf.length;
pdf += `${i + 1} 0 obj\n${object}\nendobj\n`;
return offset;
});
const xref = pdf.length;
pdf += `xref\n0 ${objects.length + 1}\n0000000000 65535 f \n`
+ offsets.map((o) => `${String(o).padStart(10, '0')} 00000 n \n`).join('')
+ `trailer\n<< /Size ${objects.length + 1} /Root 1 0 R >>\nstartxref\n${xref}\n%%EOF\n`;
return new TextEncoder().encode(pdf); // ASCII only, so string length = byte length
}
const masters = new Map(Object.entries(DRAWINGS) // by fileId: cubierta.pdf, banda.pdf, plano.pdf
.map(([id, [size, shapes]]) => [`${id}.pdf`, pdfPage(...size, shapes)]));
Jede Zeichnung ist einmal definiert, als Pfade. Die Region „art“ macht daraus das SVG, das im Canvas gemalt wird, und diese Region schreibt dieselben Pfade in ein einseitiges CMYK-PDF mit Farbaufbauten, die so gewählt sind, dass ein Proof dem Bildschirm entspricht, was das Meer auf C100 M45 Y80 K55 setzt, das Waldgrün der Palette. Jede Ressource gibt ihre Druckvorlage in svg.pdfFileId an; renderToPdf fragt nach dieser ID, pressPdf() in der kurzen Antwort antwortet mit den Bytes der Druckvorlage, und postext-pdf bettet diese Seite unverändert ein, als Vektoren in den eigenen Farben der Vorlage. Das gilt für den Grundriss, eine Abbildung, und für die Umschlagkarte und das Band der Rückseite, die Gestaltungsbilder sind. Der Graustufenproof bekommt stattdessen die SVGs, weil eine eingebettete Druckvorlage nie umgerechnet wird und farbig bliebe.
Das ganze Rezept
// ═══ Postext Cookbook · Nº 024 · Print-ready PDF: bleed, crop marks and CMYK ═══════════
// https://postext.dev/en/cookbook/print-ready-pdf
// Code: MIT · Text: original (CC BY 4.0) · Maps: generated in code (CC BY 4.0)
// Fonts: Karla, Space Grotesk, Space Mono (SIL OFL 1.1) · Needs postext ≥ 1.25.0
// An exhibition leaflet set up for the press: bleed and crop marks on every page, and a
// PDF/X-4 file separated for FOGRA51 that embeds its fonts and takes the maps and the floor
// plan from print masters, checked by the preflight before it is offered.
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, defaultResourceTypes,
preflightDocument, loadOutputProfile, outputTransform,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'es'; // @lang: the language of the sample document (this recipe is Spanish only)
const RECIPE = 'print-ready-pdf';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: screen colours, and for four of them the inks the press prints them in
const palette = {
ink: '#161616', // text: a neutral grey prints on the black plate alone (K95 on FOGRA51)
muted: '#666666', // the running heads, on black alone for the same reason (K66)
forest: '#0b3d2e', // the sea, the kickers, the back band
signal: '#ff6626', // route, waypoints, tab
sage: '#9fb8a8', // high ground; small type on forest
paper: '#f4f1ea', // type on forest: reversed out, it prints no ink at all
};
// The colours authored in CMYK (%), the same builds as the print masters (section 2), so the
// type, the tab and the drawings share their inks. Without them the profile would separate
// the forest as C90 M43 Y71 K62 and the orange as C0 M70 Y90 K0, a shade off the route.
const AUTHORED = { forest: [100, 45, 80, 55], signal: [0, 60, 85, 0], sage: [40, 20, 35, 0],
paper: [0, 0, 0, 0] };
const cmyk = ([c, m, y, k]) => ({ c, m, y, k });
const value = (id) => (AUTHORED[id]
? { hex: palette[id], model: 'cmyk', cmyk: cmyk(AUTHORED[id]) }
: { hex: palette[id], model: 'hex' });
// col(id): a palette-linked colour: the hex for the screen and, where authored, its build.
const col = (id) => ({ ...value(id), paletteId: id });
const colorPalette = [
...Object.keys(palette).map((id) => ({ id, name: id, value: value(id) })),
// The engine's defaults link to 'main-color': point it at the forest, so nothing prints blue.
{ id: 'main-color', name: 'forest (defaults)', value: { hex: palette.forest, model: 'hex' } },
];
// #endregion
// #region answer: bleed and crop marks on every page; a CMYK PDF that swaps in print masters
const BLEED = 3; // mm of artwork past the trim: the cover, the tab and the back band reach it
// Hook-up: config().page.cutLines. A mark starts markOffset outside the trim (3 mm by default)
// and never inside the bleed, and runs 5 mm (markLength). Each page grows by doc.trimOffset
Das zusammengesetzte script.js läuft unverändert: Fügen Sie es in das Modulskript einer beliebigen Seite ein, oder öffnen Sie das Rezept auf CodePen. Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)
Varianten
#5 mm Anschnitt verlangen
Bilder, Reiter und Maßstabsleiste sind aus BLEED bemessen, und die Schnittmarken beginnen an der Kante des Anschnitts, sodass eine Druckerei, die 5 mm verlangt, nur diese Änderung braucht, und jedes Blatt wächst auf 196 × 253 mm.
-const BLEED = 3; // mm of artwork past the trim: the cover, the tab and the back band reach it
+const BLEED = 5; // mm of artwork past the trim: the cover, the tab and the back band reach it#Die Bilder aus ihren SVGs drucken
Ohne pdfFileId zeichnet die Druckdatei jedes Bild aus seinem SVG, weiterhin als Vektoren und über das Profil: Das in CMYK angelegte Waldgrün behält C100 M45 Y80 K55, während die anderen Grüntöne der Inseln die Separationen des Profils statt der handverlesenen erhalten.
- updatedAt: 0, ...extra, svg: { fileId: `${id}.svg`, pdfFileId: `${id}.pdf`,
+ updatedAt: 0, ...extra, svg: { fileId: `${id}.svg`,Häufige Fehler
Häufiger Fehler
Kein <marker> und keine Filter in SVG-Grafiken (Raster-Ersatz)
Eine SVG-Abbildung bleibt im PDF nur ohne <marker>, Filter und Masken ein Vektor; andernfalls fällt sie auf ein Raster zurück, und tief verschachtelte Filter können sie in Chrome leer erscheinen lassen. Zeichnen Sie Pfeilspitzen als Pfade. Abbildungen und Tabellen als Ressourcen →
Häufiger Fehler
Fontsource-Dateien decken Buchstaben ab, keine Symbole
Das Kit bettet die latin-Datei einer Schrift von Fontsource ein, dazu ihre latin-ext-Datei für č, ł, † und ihre greek-Datei für α, χ (bei einer Familie, die eine mitliefert: Lora und Gelasio tun es nicht), wenn der Text diese Zeichen setzt, auf dem Bildschirm und im PDF. Symbole wie →, ≈, ✓ und ★ stehen in keiner dieser Dateien und fehlen im PDF: zeichnen Sie sie, setzen Sie sie als Mathematik oder wählen Sie eine Schrift, deren Dateien sie enthalten. Im PDF eingebettete Schriften →
- Ein PDF/X-Standard schreibt immer CMYK, egal was
colorSpacesagt, deshalb überschreibt der Graustufenproofprintmit{ standard: 'none' }nebencolorSpace: 'grayscale'. - Ein PDF/X-Rendering schlägt ohne sein Ausgabeprofil fehl.
renderToPdfholtfogra51.iccvonprofileBaseUrl(hier/icc/von postext.dev); übergeben Sie die Bytes der Datei alsoutputProfile, um sie selbst bereitzustellen. - Der Preflight markiert Text unter 9 pt, der in mehr als einer Farbe gesetzt ist. Die fetten Beschriftungen zu 7,5 pt in Waldgrün halten auf gestrichenem Papier in vier Farben, deshalb ist
print.preflight.smallTextSize7 pt; das Impressum zu 6,3 pt, das in Salbeigrün drei Farben auf einem vierfarbigen Band wäre, ist stattdessen papierfarben ausgespart. - Eine PDF/X-Datei enthält keine Link-Annotationen, da eine Datei für die Druckmaschine sie nicht in ihrer Bleed-Box haben darf; die Lesezeichen bleiben.
- Nach dem Bauen wird jede Schaltfläche zu einem Link „Open the PDF ↗“ und einem Download-Link, und nur die Download-Links haben die Dateinamen.
Nachweise
- Rezept
- Ignacio Ferro
- Text
- Eigener Text, CC BY 4.0
- Schriften
- Karla (SIL OFL 1.1) · Space Grotesk (SIL OFL 1.1) · Space Mono (SIL OFL 1.1)
- Code
- MIT, wie Postext
Diesen Text bearbeiten ↗ (öffnet sich in einem neuen Tab)Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)


