跳到主要内容
食谱编号189

排版食谱 · 第10章 · 输出与集成

给企业标准色加印第五色

四色加一个准确的企业Pantone:油墨表把蓝色的每一个名称都归到同一块印版PANTONE 286 C上。

本页内容
类型
报告
输出
Canvas · PDF
难度
高级
Postext
已用Postext 1.84.0测试
需要≥ 1.84.0 · postext-pdf ≥ 1.84.0
许可证
更新于2026年11月13日
代码MIT · 文本CC BY 4.0
  • 英文样例:尚无中文版本
  • 成品尺寸210 × 297 mm
  • 2栏, 栏间距7 mm
  • Source Serif 4 9.6/13.2
  • Source Sans 3
  • 8页
  • 难度
  • Postext 1.84.0
  • 排版用时145 ms
  • 298行代码

简单来说

一家保护河流的基金会的年度报告,用平常的四色油墨,再加一种准确的蓝色印刷,这种蓝就是基金会的标准色。每个文件对这种蓝的叫法都不一样,印刷文件还是把它全放在一块印版上。

成品一览

为一家虚构的、修复一条河流的基金会做的八页A4年度报告,用四色加第五色印刷,第五色就是它的企业蓝。蓝色出现在品牌通常会放它的地方:封面的色带、每节上方的横条、标题、表头、图表的柱子和封底。它的40 %和12 %网点色调填充计划柱、合计行和关键数字框,印出来是同一种油墨的网点,绝不会是四色叠印的混色。照片和文字仍用四色。PDF/X-4文件有五块印版,第五块用印刷厂存放这种油墨时的名称PANTONE 286 C命名,尽管设计里没有任何地方这样称呼它。

这道食谱解答

  • 报告用四色加上我们的企业潘通色印刷,而每个文件给这种油墨起的名字都不一样,该怎么办?

简短回答

script.js · 第20–37行在完整代码中
// The corporate blue as each source named it: the designer's swatch, an older palette that
// wrote it without the space, and the chart, drawn in Spanish, which says 'Azul Cauce'. The
// tints are the same ink at 40 % and 12 %: no process mix stands in for them.
const BLUE = { c: 100, m: 75, y: 0, k: 0 }; // what the ink looks like at 100 %, for a proof
const spot = (hex, name, tint) => ({ hex, model: 'spot', spot: { name, cmyk: BLUE, tint } });
const palette = {
  ink: { hex: '#1c2129', model: 'hex' }, // text, in process black
  muted: { hex: '#5d6573', model: 'hex' },
  blue: spot('#0033a0', 'Brand Blue'),
  blue40: spot('#99add9', 'Pantone 286C', 40),
  blue12: spot('#e0e6f3', 'Brand Blue', 12),
  ochre: { hex: '#c98a1b', model: 'hex' }, // the one process accent: the second data series
  paper: { hex: '#ffffff', model: 'hex' },
};
// The ink table: the plate's name is the printer's, and every other name prints on it.
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51', convertImages: false,
  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
    cmyk: BLUE }] };

用料

类型
Source Serif 4, Source Sans 3(SIL OFL 1.1)
素材
  • director-800.jpg
  • kingfisher-1050.jpg
  • meander-1120.jpg
  • sample-900.jpg
  • volunteers-1200.jpg
  • The river from the air, on the cover (Generated With Diffusion Models, 原创)
  • The director on the river bank (Generated With Diffusion Models, 原创)
  • Volunteers planting willow stakes (Generated With Diffusion Models, 原创)
  • A water sample at a gauging station (Generated With Diffusion Models, 原创)
  • A kingfisher on a willow branch (Generated With Diffusion Models, 原创)

做法

#1 · 一种油墨,三个名称

代码就是上面的简短回答。蓝色带着三个名称进入这份报告,真实的活儿里也常这样:设计师的色板叫Brand Blue,一套旧调色板给40 %色调写的是Pantone 286C,西班牙办公室画的图表则写Azul Cauce。没有油墨表的话,每个名称都会单独出一块印版,印刷厂会收到三种要调的蓝。油墨表里的条目给印版命名,并把其他名称列为别名;名称比较时不区分大小写、忽略空格,所以每个名称的每个色调都落到唯一的PANTONE 286 C分色版上。它的cmyk是打样时显示的替代色。

#2 · 图表写明自己的油墨

script.js · 第328–371行在完整代码中
// Kilometres of bank restored each year: the bars in the blue (data-spot="Azul Cauce"), the
// plan in its 40 % tint, the labels in process black. An alias brings both onto the plate.
const YEARS = [[2021, 3.1, 4], [2022, 4.6, 5], [2023, 6.2, 6], [2024, 7.4, 8], [2025, 9.8, 9]];
function chartArt() {
  const [W, H, BASE, LEFT, MAX] = [84, 56, 46, 8, 12];
  const y = (v) => BASE - (v / MAX) * (BASE - 4);
  const lines = [0, 4, 8, 12].map((v) => `<path d="M${LEFT} ${y(v)}H${W}" stroke="#c4cad4" `
    + `stroke-width="0.2"/><text x="${LEFT - 1.5}" y="${y(v) + 1}" font-size="2.6" `
    + `text-anchor="end" fill="#5d6573">${v}</text>`).join('');
  const bars = YEARS.map(([year, done, plan], i) => {
    const x = LEFT + 3 + i * 15;
    return `<rect x="${x}" y="${y(plan)}" width="5" height="${BASE - y(plan)}" fill="#99add9" `
      + `data-spot="Azul Cauce" data-spot-tint="40"/><rect x="${x + 5.6}" y="${y(done)}" `
      + `width="5" height="${BASE - y(done)}" fill="#0033a0" data-spot="Azul Cauce"/>`
      + `<text x="${x + 5.3}" y="${BASE + 5}" font-size="2.8" text-anchor="middle" `
      + `fill="#1c2129">${year}</text>`;
  }).join('');
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W * 10}" height="${H * 10}" `
    + `viewBox="0 0 ${W} ${H}" font-family="'Source Sans 3'">${lines}${bars}</svg>`;
}
// Where each euro went: one bar across the text block, the river in the full ink, schools in
// its 40 % tint, the running costs in process grey.
const SPENT = [[1520, '#0033a0', 100, t({ en: 'Work on the river', es: 'Obras en el río' })],
  [340, '#99add9', 40, t({ en: 'Schools', es: 'Escuelas' })],
  [180, '#9aa1ad', 0, t({ en: 'Running costs', es: 'Funcionamiento' })]];
function euroArt() {
  const [W, H] = [174, 22];
  const total = SPENT.reduce((sum, [v]) => sum + v, 0);
  let x = 0;
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W * 10}" height="${H * 10}" `
    + `viewBox="0 0 ${W} ${H}" font-family="'Source Sans 3'">`
    + `${SPENT.map(([v, hex, tint, name], i) => {
      const w = (v / total) * W;
      const ink = tint ? ` data-spot="Azul Cauce" data-spot-tint="${tint}"` : '';
      const end = i === SPENT.length - 1; // the last label sets flush right, under its segment
      const tx = `x="${end ? W : x}" text-anchor="${end ? 'end' : 'start'}"`;
      const part = `<rect x="${x}" y="0" width="${w - 0.6}" height="10" fill="${hex}"${ink}/>`
        + `<text ${tx} y="15.5" font-size="3.2" font-weight="700" fill="#1c2129">`
        + `${Math.round((v / total) * 100)} %</text><text ${tx} y="20" font-size="2.8" `
        + `fill="#5d6573">${name}</text>`;
      x += w;
      return part;
    }).join('')}</svg>`;
}

SVG用data-spot说明一个颜色印在哪种油墨上,用data-spot-tint以百分比说明浓度。图表的柱子写的是100 %和40 %的Azul Cauce,别名把它们放到和其余蓝色同一块印版上。网格线和标签是普通颜色,留在四色黑里。财务页上的支出长条也一样,分三段,第三段是四色灰。

#3 · 蓝色撑起整个设计

script.js · 第55–73行在完整代码中
const BAND = 172; // mm from the top of the bleed to the top of the blue band
const cover = { id: 'cover', numbered: false, toc: false, span: 'page',
  header: { elements: [] }, footer: { elements: [] },
  margins: { top: mm(0), bottom: mm(0), left: mm(0), right: mm(0) },
  advancedDesign: { enabled: true, minHeight: mm(TRIM_H), slot: { elements: [
    { kind: 'image', id: 'photo', resourceId: 'meander', fit: 'cover',
      placement: at('bleed', 'top-left', 0, 0, { width: 'fill', height: mm(BAND + 1) }) },
    { kind: 'box', id: 'band', style: { backgroundColor: col('blue') },
      placement: at('bleed', 'top-left', 0, BAND, { width: 'fill', height: mm(TRIM_H) }) },
    text('name', '{author}', label(10, col('paper')), at('page', 'top-left', 20, BAND + 14)),
    text('title', '{titleText}', { fontFamily: SANS, fontWeight: 800, fontSize: pt(46),
      lineHeight: 1, color: col('paper') }, at('#name', 'below', 0, 6, { width: mm(170) })),
    { kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(3), color: col('blue40'),
      placement: at('#title', 'below', 0, 7, { width: mm(24) }) },
    text('strap', '{attr.strap}', { fontFamily: 'Source Serif 4', italic: true, fontSize: pt(15),
      lineHeight: 1.3, color: col('paper') }, at('#rule', 'below', 0, 6, { width: mm(120) })),
    text('credit', '{attr.credit}', { fontFamily: SANS, fontSize: pt(7), color: col('blue40') },
      at('page', 'bottom-left', 20, -14, { width: mm(170) })),
  ] } } };

封面照片用fit: 'cover'铺满出血区的上部,一个蓝色的框填满其余部分;上面的字是白色,在印版上镂空。各节的横条、页脚和表头用的是调色板里的同一个条目,所以换油墨只要改一行。

script.js · 第315–324行在完整代码中
// A row whose first cell is bold is a total: it takes the tint. Figures align right.
function tsvTable(tsv, columnWidths) {
  let m = Object.assign(parseTSV(tsv, { headerRows: 1 }), { columnWidths });
  m.rows.forEach((row, r) => row.forEach((_, c) => {
    if (c > 0) m = setAlignment(m, { row: r, col: c }, 'right', 'middle');
    if (r && row[0].content.startsWith('**')) m = setCellBackground(m, { row: r, col: c },
      col('blue12'));
  }));
  return m;
}

表格来自正文旁边的TSV文件。第一个单元格是粗体的行就是合计行,用12 %色调;数字右对齐。

#4 · 照片保持RGB

打印设置里的convertImages: false让照片保持为带sRGB标签的RGB JPEG,PDF/X-4允许这样做;由印刷厂的RIP来分色。文件很小,蓝色印版上也不会沾到照片的任何东西。

完整食谱

沙盒
// ═══ Postext Cookbook · Nº 189 · A fifth ink for the corporate colour ═══════════════════
// https://postext.dev/en/cookbook/corporate-fifth-ink-report
// Code: MIT · Text: original (CC BY 4.0) · Photographs: diffusion models
// Fonts: Source Serif 4, Source Sans 3 (SIL OFL 1.1) · Needs postext ≥ 1.84.0
//
// An annual report printed in four colours and one exact corporate blue. The palette, the
// chart and an older swatch call the blue by three names; the ink table gathers them on one
// plate named as the printer stocks the ink, PANTONE 286 C.
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, parseTSV, setCellBackground,
  setAlignment, inlineSvgFonts,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'corporate-fifth-ink-report';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region answer: one spot ink, three names: the ink table puts them on one plate
// The corporate blue as each source named it: the designer's swatch, an older palette that
// wrote it without the space, and the chart, drawn in Spanish, which says 'Azul Cauce'. The
// tints are the same ink at 40 % and 12 %: no process mix stands in for them.
const BLUE = { c: 100, m: 75, y: 0, k: 0 }; // what the ink looks like at 100 %, for a proof
const spot = (hex, name, tint) => ({ hex, model: 'spot', spot: { name, cmyk: BLUE, tint } });
const palette = {
  ink: { hex: '#1c2129', model: 'hex' }, // text, in process black
  muted: { hex: '#5d6573', model: 'hex' },
  blue: spot('#0033a0', 'Brand Blue'),
  blue40: spot('#99add9', 'Pantone 286C', 40),
  blue12: spot('#e0e6f3', 'Brand Blue', 12),
  ochre: { hex: '#c98a1b', model: 'hex' }, // the one process accent: the second data series
  paper: { hex: '#ffffff', model: 'hex' },
};
// The ink table: the plate's name is the printer's, and every other name prints on it.
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra51', convertImages: false,
  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
    cmyk: BLUE }] };
// #endregion
const col = (id) => ({ ...palette[id], paletteId: id });
const colorPalette = [...Object.entries(palette).map(([id, value]) => ({ id, name: id, value })),
  { id: 'main-color', name: 'blue (defaults)', value: palette.blue }];

const [TRIM_W, TRIM_H] = [210, 297]; // A4
const MARGIN = { top: 24, bottom: 24, inner: 20, outer: 16 };
const LEAD = 13.2; // pt
const SANS = 'Source Sans 3';
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
  offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });

组合好的script.js可以直接运行:把它粘贴到任何页面的模块脚本中,或在CodePen上打开这道食谱。 GitHub上的食谱文件夹 ↗ (在新标签页中打开)

变化

#用四色印蓝色

印刷机没有第五个机组时,在油墨表里加一个词,蓝色的每个色调就按它的替代色用CMYK印出来。

-  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
-    cmyk: BLUE }] };
+  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
+    cmyk: BLUE, output: 'process' }] };

#按另一家印刷厂的要求给印版命名

有些印刷厂要用自己的名称来命名印版。pdfName给印版改名,别名保留不变。

-  inks: [{ name: 'PANTONE 286 C', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],
+  inks: [{ name: 'PANTONE 286 C', pdfName: 'PANTONE 286 U', aliases: ['Brand Blue', 'Pantone 286C', 'Azul Cauce'],

常见问题

  • 图片里的颜色如果既没有写明油墨,也不和调色板里某个专色完全一致,就会留在四色里,哪怕看起来就是那种蓝。用data-spot标记这些元素,或者在调色板里加一个hex完全相同的专色。
  • 带数字的字体族名,比如Source Sans 3,在SVG的font-family里要加引号;不加的话浏览器会丢掉这条声明,用衬线体排标签。

致谢

文本
原创文字, CC BY 4.0
图片
  • The river from the air, on the cover · Generated With Diffusion Models · 原创
  • The director on the river bank · Generated With Diffusion Models · 原创
  • Volunteers planting willow stakes · Generated With Diffusion Models · 原创
  • A water sample at a gauging station · Generated With Diffusion Models · 原创
  • A kingfisher on a willow branch · Generated With Diffusion Models · 原创
字体
Source Serif 4 (SIL OFL 1.1) · Source Sans 3 (SIL OFL 1.1)
沙盒PDF