かんたんな説明
スペインの小説の表紙を一度だけデザインし、3つのプリント・オン・デマンド会社向けに作ります。刷り上がる3枚の表紙が同じ縮尺で並び、それぞれの背幅、大きさ、チェックの結果がわかります。
できあがり
ベニート・ペレス・ガルドスの1878年の小説『マリアネラ』を、6 × 9インチの本にします。英語版はクララ・ベルの1883年の訳、スペイン語版はガルドスの原文です。ページは扉、権利表記、第1章で、ソカルテスの鉄鉱山で道に迷った眼科医を、目の見えない若者が連れ出します。表紙のデザインは一度だけです。パブロとネラの絵が表1の全面を覆い、書名はその空に置き、表4と背は鉱山の土のレンガ色にします。ペンはこれをKDPの上製本、IngramSparkの並製本、Luluのケースラップとして3回作り、ガイドつきの3枚の用紙を同じ縮尺で並べます。背が太くなった分や上製本の折り返しの分が、そのまま幅の違いとして見えます。
このレシピが答える質問
- 一つの表紙デザインで、同じ本をKDP、IngramSpark、Luluで刷るには?
- KDPのペーパーバックの表紙を、背幅とバーコード枠までKDPの寸法どおりに作るには?
手短な答え
// One book, three printers. KDP's case laminate adds its boards to the pages' bulk and
// keeps a box for the barcode of the ISBN it assigns; IngramSpark publishes no spine
// formula, so its profile estimates the spine from the paper's pages per inch and says
// so; Lulu's casewrap takes its spine from Lulu's table by page count. The IngramSpark
// edition carries an ISBN of its own, printed as a barcode on its back.
const production = {
versions: [
{ id: 'kdp', name: 'KDP hardcover', binding: 'kdp-hardcover-cream', barcodeBy: 'printer' },
{ id: 'ingram', name: 'IngramSpark paperback', binding: 'ingramspark-paperback-creme',
isbn: '978-84-0000-226-8' },
{ id: 'lulu', name: 'Lulu casewrap', binding: 'lulu-casewrap' },
],
};
// The design, once for the three: the painting over the whole front, the title on its sky
// and the author at its foot (anchored to the panel, so each sheet places them anew), the
// back and the spine in the red of the earth.
const size = (width, height) => ({ x: 0, y: 0, width, height });
const cover = {
background: col('earth'),
image: { resourceId: 'socartes', area: 'front' },
verticalAlign: { back: 'middle' },
textBoxes: [
{ name: 'title', rect: size(130, 24), anchor: { to: 'front', edge: 'top', y: 12 } },
{ name: 'author', rect: size(120, 9), anchor: { to: 'front', edge: 'bottom', y: -10 } },
],
};
材料
- 機能
- プリント・オン・デマンドのプロファイル(KDP、IngramSpark、Lulu)表紙の用紙印刷版、ISBN、背幅表紙、扉、奥付表紙のテキスト枠販売ページのチェック(キーワード、内容紹介)見出しスタイルデザインした章扉ページデザインのテキスト・罫・ボックス文書のメタデータ段落スタイル柱とノンブルリソースとしての図と表セマンティックカラーパレットPDFの書き出しキャンバス上のページ
- 種類
- Source Serif 4, Fraunces, Source Sans 3 (SIL OFL 1.1)
- 素材
marianela-1024.jpg- The cover painting: a barefoot girl leading a tall blind young man by the hand along a path above open-cast iron mines at dusk, in oils (Generated With Diffusion Models, オリジナル)
作り方
#1 · 文字は一度だけ書き、3枚で共有する
const style = (id, fontFamily, size, lead, color, extra) => ({ id, fontFamily, fontSize: pt(size),
lineHeight: pt(lead), color, italicColor: color, boldColor: color, firstLineIndent: mm(0),
textAlign: 'left', hyphenation: false, ...extra });
const mid = { textAlign: 'center' };
const narrow = { indent: mm(16), endIndent: mm(16) };
const coverStyles = [
style('cover-title', 'Fraunces', 50, 54, col('ink'), { ...mid, fontWeight: 600 }),
style('cover-author', 'Fraunces', 16, 19, col('bone'), mid),
style('cover-spine', 'Fraunces', 10.5, 12, col('bone'), mid),
style('cover-blurb', 'Source Serif 4', 11.5, 16, col('bone'), { textAlign: 'justify',
hyphenation: true, firstLineIndent: mm(4), ...narrow }),
style('cover-blurb-first', 'Source Serif 4', 11.5, 16, col('bone'), { textAlign: 'justify',
hyphenation: true, ...narrow }),
style('cover-quote', 'Fraunces', 16, 21, col('bone'), { ...mid, italic: true, ...narrow,
marginTop: pt(14), marginBottom: pt(14) }),
style('cover-note', 'Source Serif 4', 10, 13, col('bone'), { ...mid, italic: true,
marginTop: pt(12) }),
];
手短な答えには3つの版があり、それぞれがプリント・オン・デマンドのプロファイルを1つ指定します。coverは3つの版で共通です。書名と著者名の枠は座標ではなく表1の面に固定してあるので、各用紙が自分の表1の面に置きます。背が太くなるほど、その面は右へずれます。表4の文字はフレームの空きの中で中央に置かれます。KDPではその空きがバーコードの枠の上で終わります。
#2 · 6 × 9インチの本文
const [W, H, TOP, FOOT, INNER, OUTER, LEAD] = [152.4, 228.6, 22, 22, 22, 18, 15]; // mm, pt
const at = (to, edge, x, y, box) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) },
...(box && { size: box }) });
const text = (id, content, look, place) => ({ kind: 'text', id, content, align: 'center',
overflow: 'wrap', placement: place, ...look });
const face = (fontFamily, size, color, x) => ({ fontFamily, fontSize: pt(size), color, ...x });
const label = (size, color = col('muted')) => face('Source Sans 3', size, color,
{ fontWeight: 600, letterSpacing: pt(size / 6), textTransform: 'uppercase' });
const none = { header: { elements: [] }, footer: { elements: [] }, numbered: false, toc: false };
const design = (minHeight, elements) => ({ enabled: true, minHeight: mm(minHeight),
slot: { elements } });
const page = (parity) => ({ breakBefore: { enabled: true, parity } });
const rule = (id, y, to = 'container') => ({ kind: 'rule', id, direction: 'horizontal',
thickness: pt(0.6), color: col('accent'), placement: at(to, 'top', 0, y, { width: mm(14) }) });
const wide = { width: mm(W - INNER - OUTER) };
const headingStyles = [
{ ...none, ...page('odd'), id: 'title-page', advancedDesign: design(H - TOP - FOOT, [
text('t', '{title}', face('Fraunces', 34, col('ink'), { fontWeight: 600 }),
at('page', 'top', 0, 56, wide)),
text('s', '{subtitle}', face('Source Serif 4', 13, col('muted'), { italic: true }),
at('page', 'top', 0, 76)),
rule('r', 88, 'page'),
text('a', '{author}', label(9, col('accent')), at('page', 'top', 0, 94)),
text('c', '{attr.credit}', face('Source Serif 4', 10, col('muted'), { italic: true }),
at('page', 'top', 0, 102, wide)),
text('i', '{attr.imprint}', label(7.5), at('page', 'bottom', 0, -28)),
]) },
{ ...none, ...page('even'), id: 'rights', advancedDesign: design(120, [rule('r', 114)]) },
// Each chapter on a recto, sunk 60 mm: its numeral in red, its title in Fraunces.
{ ...page('odd'), id: 'chapter', toc: false, advancedDesign: design(60, [
text('n', '{attr.number}', face('Fraunces', 30, col('accent'), { fontWeight: 600 }),
at('container', 'top', 0, 14)),
text('t', '{titleText}', face('Fraunces', 18, col('ink'), { italic: true }),
at('container', 'top', 0, 32, wide)),
rule('r', 46)]) },
];
const head = (id, content, parity) => text(id, content, { ...label(6.8), parity, pages: 'body' },
at('page', 'top', 0, 12));
3つのプラットフォームはどれもこの判型で印刷するので、本文は1つで3つの版に足ります。章扉は見出しとその属性から番号と題を組み、扉は訳者の名前を{attr.credit}から取ります。
#3 · 小説全体のページ数
// The pen sets the first chapter only. The spines need the whole book, so the count is
// worked out from the words a page of this design holds, over the novel's length, with
// four pages of front matter.
const WORDS = t({ en: 55730, es: 50000 }); // Gutenberg 48818; Wikisource, about
const body = markdown.split(/^# .*\{style="chapter"/m)[1] ?? markdown;
const perPage = body.split(/\s+/).length / (book.pages.length - 2);
const pages = 4 + 2 * Math.ceil(WORDS / perPage / 2);
ペンが組むのは8ページ、つまり前付けと第1章だけです。背には本全体が要るので、このデザインの本文1ページに入る語数と、全文の長さからページ数を出します。英語版は170ページ、スペイン語版は174ページです。これは推定値で、以下の背幅はすべてここから出ています。本全体のbook.pagesを渡せば、背幅は実際のページ数に従います。
#4 · 印刷所ごとに1枚の用紙
const builds = production.versions.map(({ id }) => {
const built = buildCover({ config, version: id, pages, markdown: coverText,
metadata: book.metadata, resources });
if (!('config' in built)) throw new Error(built.issues.map((i) => i.kind).join(', '));
return { id, built };
});
const sheets = [];
for (const { built } of builds) {
// The barcode's digits name OCR-B, which no font server has: the label face sets them.
for (const [id, bytes] of Object.entries(built.files)) {
await loadSvg(id, new TextDecoder().decode(bytes)
.replace(/font-family="[^"]*"/g, 'font-family="Source Sans 3"'));
}
sheets.push(await buildDocumentWithFonts(built.content, built.config, kitFonts(FONTS)));
}
buildCoverは版ごとに1回、同じ表紙のMarkdownで実行します。背幅の測り方はプロファイルごとに違います。KDPのラミネート上製本はページに板紙の分を足し、英語版では0.614インチ(15.6 mm)です。IngramSparkは計算式を公開していないので、プロファイルがクリーム紙の1インチあたりのページ数から0.383インチ(9.7 mm)と見積もります。Luluはページ数で自社の表を引き、0.688インチ(17.5 mm)になります。ISBNがあるのはIngramSparkの版だけで、そのバーコードのSVGは数字をラベルの書体で組んで読み込みます。
#5 · 3枚の用紙を並べる
// Every sheet is drawn at 1.4 px a mm, so a wider spine or a case's wrap shows as width.
// `coverGuideShapes` gives each sheet's trim, folds, safe areas and barcode box in mm.
const PX = 1.4;
const inch = (v) => `${(v / 25.4).toFixed(3)} in`;
const row = document.createElement('section');
row.id = 'printers';
row.style.cssText = 'display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; '
+ 'align-items: flex-start; padding: 24px 16px; color: #ece4d6; '
+ 'font: 13px/1.45 system-ui, sans-serif';
builds.forEach(({ id, built }, n) => {
const leaf = sheets[n].pages[0];
const [fig, canvas, cap] = ['figure', 'canvas', 'figcaption']
.map((tag) => document.createElement(tag));
const version = production.versions.find((v) => v.id === id);
canvas.setAttribute('role', 'img');
canvas.setAttribute('aria-label', `${version.name}: ${t({ en: 'the cover sheet with its guides',
es: 'el pliego de cubierta con sus guías' })}`);
renderPageToCanvas(leaf, sheets[n], canvas, { scale: (PX * built.sheet.width) / leaf.width });
const ctx = canvas.getContext('2d');
ctx.setTransform(1, 0, 0, 1, 0, 0);
paintGuides(ctx, coverGuideShapes(built), canvas.width / built.sheet.width);
canvas.style.cssText = `display: block; width: ${PX * built.sheet.width}px; max-width: 100%`;
const spine = built.sheets.spine.caseSpine ?? built.sheets.spine.used;
const checks = built.issues.filter((i) => !i.kind.startsWith('listing')).map((i) => i.kind);
cap.textContent = `${version.name} · ${pages} ${t({ en: 'pages', es: 'páginas' })} · `
+ `${t({ en: 'spine', es: 'lomo' })} ${inch(spine)} `
+ `(${spine.toFixed(1)} mm) · ${inch(built.sheet.width)} × ${inch(built.sheet.height)} · `
+ `${checks.length ? checks.join(', ') : t({ en: 'no checks raised', es: 'sin avisos' })}`;
fig.style.cssText = 'margin: 0; max-width: 100%';
cap.style.cssText = `max-width: ${PX * built.sheet.width}px; margin-top: 6px`;
fig.append(canvas, cap);
row.append(fig);
});
document.getElementById('pages').before(row);
各用紙は1 mmあたり1.4 pxでガイドとともに描かれ、キャプションにページ数、背幅、用紙全体のインチ寸法、出たチェックが並びます。KDPの上製本は、KDPが印刷するバーコードのために2 × 1.2インチの枠を空けてあり、デザインはその中に何も置いていません。IngramSparkの用紙には本自身のバーコードが入り、キャプションにspineEstimatedが出ます。印刷の前にIngramSparkのテンプレートをダウンロードして、背幅を見比べてください。LuluのケースラップにはISBNがないので、バーコードも枠もありません。上製本の2枚は高さが約10.4インチと10.75インチで、並製本の9.25インチより高くなります。折り返しが板紙をくるむからです。
レシピの全体
// ═══ Postext Cookbook · Nº 226 · One cover design for three print-on-demand printers ═══
// https://postext.dev/en/cookbook/one-cover-three-printers
// Code: MIT · Text: B. Pérez Galdós, tr. C. Bell (public domain) · Art: diffusion models
// Fonts: Source Serif 4, Fraunces, Source Sans 3 (SIL OFL 1.1) · Needs postext ≥ 1.104.0
//
// Marianela, a 6 × 9 in novel, printed three ways: a KDP hardcover, an IngramSpark paperback
// and a Lulu casewrap. Each version names its platform's binding profile; the cover is
// designed once. Each sheet comes out at its printer's measures, with its own spine, wrap
// and checks, and the pen lays the three side by side at one scale.
import { buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, inlineSvgFonts }
from 'https://esm.sh/postext';
import { buildCover, coverGuideShapes, paintGuides } from 'https://esm.sh/postext/production';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'one-cover-three-printers';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// The pages' colours, then the cover's: the red of the mine's earth, cream type, slate.
const palette = { ink: '#2b211d', accent: '#a23b1f', muted: '#6f625b', paper: '#fbf7f0',
rule: '#cdbba8', earth: '#5a2016', bone: '#f4ead9', slate: '#2e3a3a' };
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'accent (defaults)', value: { hex: palette.accent, model: 'hex' } },
];
// #region answer: three versions, each naming its platform's built-in profile
// One book, three printers. KDP's case laminate adds its boards to the pages' bulk and
// keeps a box for the barcode of the ISBN it assigns; IngramSpark publishes no spine
// formula, so its profile estimates the spine from the paper's pages per inch and says
// so; Lulu's casewrap takes its spine from Lulu's table by page count. The IngramSpark
// edition carries an ISBN of its own, printed as a barcode on its back.
const production = {
versions: [
{ id: 'kdp', name: 'KDP hardcover', binding: 'kdp-hardcover-cream', barcodeBy: 'printer' },
{ id: 'ingram', name: 'IngramSpark paperback', binding: 'ingramspark-paperback-creme',
isbn: '978-84-0000-226-8' },
{ id: 'lulu', name: 'Lulu casewrap', binding: 'lulu-casewrap' },
],
};
// The design, once for the three: the painting over the whole front, the title on its sky
// and the author at its foot (anchored to the panel, so each sheet places them anew), the
// back and the spine in the red of the earth.
const size = (width, height) => ({ x: 0, y: 0, width, height });
const cover = {
background: col('earth'),
image: { resourceId: 'socartes', area: 'front' },
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
#IngramSparkの背幅をテンプレートから書く
このページ数でIngramSparkが送ってくるテンプレートの幅が違うときは、版のspineOverrideでその幅を指定します。チェックはspineOverriddenになり、両方の値を示します。
{ id: 'ingram', name: 'IngramSpark paperback', binding: 'ingramspark-paperback-creme',
- isbn: '978-84-0000-226-8' },
+ isbn: '978-84-0000-226-8', spineOverride: 9.9 },#Luluの版を並製本にする
lulu-paperbackは背幅をページ数 ÷ 444 + 0.06インチで測ります。板紙も折り返しもありません。
- { id: 'lulu', name: 'Lulu casewrap', binding: 'lulu-casewrap' },
+ { id: 'lulu', name: 'Lulu paperback', binding: 'lulu-paperback' },よくあるつまずき
- 表4に座標で置いたデザイン要素は、ある用紙ではKDPのバーコードの枠に入り、別の用紙では入らないことがあります。そのときKDPの用紙は
coverBarcodeZoneBusyを報告します。枠は面に固定してください。 - ここでISBNがあるのは1つの版だけです。バーコードのSVGはどの版でも同じファイルid(
cover-isbn.svg)なので、このペンのように複数の版のファイルを読み込むとき、バーコードのある版が2つあれば最後の1つしか残りません。
クレジット
- 本文
- Marianela, by B. Perez Galdós, from the Spanish by Clara Bell (William S. Gottsberger, New York, 1883), Project Gutenberg eBook #48818 · Clara Bell · パブリックドメイン
- Marianela (Madrid, 1878), chapter I, as transcribed on Wikisource from the copy in the Biblioteca Digital Hispánica, with the spelling of 1878 · Benito Pérez Galdós · パブリックドメイン
- 画像
- The cover painting: a barefoot girl leading a tall blind young man by the hand along a path above open-cast iron mines at dusk, in oils · Generated With Diffusion Models · オリジナル
- フォント
- Source Serif 4 (SIL OFL 1.1) · Fraunces (SIL OFL 1.1) · Source Sans 3 (SIL OFL 1.1)


