本文へスキップ
レシピ番号225

レシピ集 · 第10章 · 出力と組み込み

KDPペーパーバックの表紙と確認用画像、販売ページ

『ペピータ・ヒメネス』をクリーム紙の6 × 9インチKDPペーパーバックに。KDPの寸法どおりの表紙用紙、ガイド付きの確認用画像、計算ツールの数値、販売ページのチェック。

このページの内容
出力
Canvas · PDF
レベル
上級
Postext
Postext 1.104.0で検証済み
1.104.0以上が必要 · postext-pdf ≥ 1.104.0
ライセンス
2026年12月4日更新
コードMIT · 本文CC BY 4.0
  • 英語の見本:日本語版はまだありません
  • 仕上がり152.4 × 228.6 mm
  • 1段
  • Spectral 10.5/15
  • Playfair Display
  • Work Sans
  • 10ページ
  • レベル
  • Postext 1.104.0
  • 組版時間88 ms
  • コード261行

かんたんな説明

スペインの短い小説を、Amazonのプリント・オン・デマンドのペーパーバックにします。広げた表紙、印刷所のガイド線を重ねた同じ表紙、その寸法、そしてAmazonの規則で確かめた検索キーワードとストアの内容紹介です。

できあがり

フアン・バレーラが1874年に書いた小説『ペピータ・ヒメネス』を、Amazon KDPがクリーム紙に刷る6 × 9インチのペーパーバックにします。一方の版は1886年の英訳、もう一方はバレーラのスペイン語の原文です。ページは扉、権利表記、ラテン語のエピグラフを掲げた編者の序文、そしてルイス・デ・バルガスが叔父に宛てた最初の手紙です。表紙は1枚の用紙です。オリーブがかった黒の地が表4から背まで続き、表1の下半分を果樹園の絵が占め、その上にクリーム色の書名が立ちます。バーコードはKDPが割り当てるISBNのものをKDPが刷るので、表4はその枠を空けておきます。ページの上には、KDPのガイドを重ねた確認用の表紙と刷り上がりの表紙を描き、KDPの表紙計算ツールが出す数値を並べ、本のキーワードと内容紹介をKDPの規則で確かめます。

このレシピが答える質問

  • KDPのペーパーバックの表紙を、背幅とバーコード枠までKDPの寸法どおりに作るには?
  • 出版前に本のキーワードと内容紹介をAmazonの規則で確かめるには?

手短な答え

script.js · 31〜54行コード全体で見る
// `binding` names a built-in profile: KDP's bleed (0.125 in), its spine of 0.0025 in a page
// on cream paper, its rule of no spine text under 79 pages, and the 2 × 1.2 in box on the
// back where KDP prints the barcode of the ISBN it assigns. `barcodeBy: 'printer'` keeps
// that box clear: the back's text frame ends above it, and anything the design put in it
// would be reported as `coverBarcodeZoneBusy`.
const production = {
  versions: [{ id: 'kdp', name: 'KDP paperback', binding: 'kdp-paperback-cream',
    barcodeBy: 'printer' }],
};
// The cover: an olive black ground over the whole wrap, the painting on the lower part of
// the front, and the title over the ground above it. The back takes the blurb, the spine
// the title and the author from the front matter.
const size = (width, height) => ({ x: 0, y: 0, width, height });
const cover = {
  background: col('night'),
  elements: [{ id: 'art', kind: 'image', zone: 'front', x: 0, y: 64, width: 155.6, height: 168,
    resourceId: 'orchard', fit: 'cover' }],
  verticalAlign: { back: 'middle' },
  textBoxes: [
    { name: 'author', rect: size(130, 8), anchor: { to: 'front', edge: 'top', y: 10 } },
    { name: 'title', rect: size(140, 22), anchor: { to: 'author', edge: 'below', y: 3 } },
    { name: 'subtitle', rect: size(130, 9), anchor: { to: 'title', edge: 'below', y: 1 } },
  ],
};

材料

種類
Spectral, Playfair Display, Work Sans (SIL OFL 1.1)
素材
  • pepita-1024.jpg
  • The cover painting: a young widow in black with a sprig of orange blossom by a fountain in an Andalusian orchard, and a seminarian among the orange trees behind her, in oils (Generated With Diffusion Models, オリジナル)

作り方

#1 · 表紙の書体

script.js · 58〜78行コード全体で見る
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 caps = (tracking) => ({ fontWeight: 600, letterSpacing: pt(tracking) });
const narrow = { indent: mm(17), endIndent: mm(17) };
const coverStyles = [
  style('cover-author', 'Playfair Display', 14, 17, col('gold'), mid),
  style('cover-title', 'Playfair Display', 46, 50, col('bone'), { ...mid, fontWeight: 500 }),
  style('cover-subtitle', 'Spectral', 15, 19, col('gold'), { ...mid, italic: true }),
  style('cover-spine', 'Playfair Display', 10.5, 12, col('bone'), mid),
  // The back's frame runs across the panel: the blurb keeps a measure of 112 mm inside it.
  style('cover-blurb', 'Spectral', 11.5, 16, col('bone'), { textAlign: 'justify',
    hyphenation: true, firstLineIndent: mm(4), ...narrow }),
  style('cover-blurb-first', 'Spectral', 11.5, 16, col('bone'), { textAlign: 'justify',
    hyphenation: true, ...narrow }),
  style('cover-quote', 'Playfair Display', 16, 21, col('gold'), { ...mid, italic: true,
    marginTop: pt(14), marginBottom: pt(14) }),
  style('cover-note', 'Spectral', 10, 13, col('gold'), { ...mid, italic: true,
    marginTop: pt(12) }),
];

手短な答えはkdp-paperback-creamを指定します。Postextのプリント・オン・デマンド用プロファイルの一つで、KDPの塗り足し0.125インチ、クリーム紙1ページあたり0.0025インチの背幅、KDPがバーコードを置く表4の枠を持っています。表紙のスタイルが決めるのは書体だけです。表4の枠は面の安全領域いっぱいに広がるので、紹介文はindentとendIndentで行長を112 mmに抑え、verticalAlignでバーコードの枠より上の空きの中央に置きます。

#2 · 6 × 9インチの本文

script.js · 82〜124行コード全体で見る
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('Work Sans', size, color,
  { ...caps(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('a', '{author}', label(9, col('accent')), at('page', 'top', 0, 52)),
    text('t', '{title}', face('Playfair Display', 32, col('ink'), { fontWeight: 500 }),
      at('page', 'top', 0, 62, wide)),
    text('s', '{subtitle}', face('Spectral', 13, col('muted'), { italic: true }),
      at('page', 'top', 0, 80)),
    rule('r', 92, 'page'),
    text('i', '{attr.imprint}', label(7.5), at('page', 'bottom', 0, -28)),
  ]) },
  { ...none, ...page('even'), id: 'rights', advancedDesign: design(120, [rule('r', 114)]) },
  // The editor's foreword opens under the title and its Latin motto, sunk 56 mm.
  { ...none, ...page('odd'), id: 'opener', advancedDesign: design(56, [
    text('t', '{titleText}', face('Playfair Display', 24, col('ink'), { fontWeight: 500 }),
      at('container', 'top', 0, 18, wide)),
    text('m', '{attr.motto}', face('Spectral', 11, col('muted'), { italic: true }),
      at('container', 'top', 0, 34, wide)),
    rule('r', 46)]) },
  // The first part on a recto: its numeral over its title, the letters below.
  { ...page('odd'), id: 'part', toc: false, advancedDesign: design(64, [
    text('n', '{attr.part}', face('Playfair Display', 15, col('accent')),
      at('container', 'top', 0, 17)),
    text('t', '{titleText}', face('Playfair Display', 19, col('ink'), { fontWeight: 500 }),
      at('container', 'top', 0, 28, wide)),
    rule('r', 46)]) },
];
const head = (id, content, parity) => text(id, content, { ...label(6.8), parity, pages: 'body' },
  at('page', 'top', 0, 12));

仕上がりはKDPでいちばん多い152.4 × 228.6 mmで、のどの余白を製本のために広くとります。扉と各章の始まりの文字はフロントマターと見出しの属性({attr.imprint}、{attr.motto}、{attr.part})から入るので、Markdownが言葉を持ち、設定が位置を持ちます。

#3 · 小説全体のページ数

script.js · 333〜339行コード全体で見る
// The pen sets the novel's opening, not its 64,000 words. The spine needs the whole book,
// so the count is worked out from the words a page of this design holds: the body pages
// laid out here, the words they set, the novel's length, and four pages of front matter.
const WORDS = t({ en: 63750, es: 56790 }); // the whole text, Project Gutenberg 30236 / 17223
const body = markdown.split(/^# .*\{style="opener"/m)[1] ?? markdown;
const perPage = body.split(/\s+/).length / (book.pages.length - 2);
const pages = 4 + 2 * Math.ceil(WORDS / perPage / 2);

組むのは9ページです。前付け、序文、最初の手紙で、手紙は段落と段落の間で切ります。背幅には本全体が要るので、ページ数はこのデザインの本文1ページに入る語数と全文の長さから出します。英語版は232ページになり、背幅は0.580インチ(14.73 mm)です。これは見積もりです。本全体を組んで、この数の代わりにbook.pagesを渡せば、背幅は実際のページ数に従います。

#4 · KDPの寸法どおりの表紙用紙

script.js · 343〜346行コード全体で見る
const built = buildCover({ config, version: 'kdp', pages, markdown: coverText,
  metadata: book.metadata, resources });
if (!('config' in built)) throw new Error(built.issues.map((i) => i.kind).join(', '));
const sheet = await buildDocumentWithFonts(built.content, built.config, kitFonts(FONTS));

buildCoverはページ数、フロントマター、表紙のMarkdownを受け取り、1ページだけの文書を返します。そのページが表紙用紙で、英語版は塗り足し込みで12.830 × 9.250インチです。barcodeBy: 'printer'はKDPの2 × 1.2インチの枠を空けたままにします。枠は背の折り目と地から0.25インチの位置にあり、表4の文字の枠はその上で終わります。232ページなら背に文字を入れられます。79ページ未満だとKDPは背の文字を認めず、チェックspineTextTooFewPagesがそれを知らせます。

#5 · KDPのガイド付きの確認用画像

script.js · 353〜378行コード全体で見る
// `coverGuideShapes` gives the trim, the folds, each panel's safe area and the barcode box
// in mm on the sheet; `paintGuides` draws them on any 2D canvas at so many pixels a mm.
const leaf = sheet.pages[0];
const views = document.createElement('section');
views.id = 'kdp';
views.style.cssText = 'display: grid; gap: 18px; padding: 24px 16px; color: #e8e2d6; '
  + 'grid-template-columns: repeat(auto-fit, minmax(300px, 620px)); justify-content: center; '
  + 'font: 14px/1.45 system-ui, sans-serif';
const figure = (caption, guides) => {
  const [fig, canvas, cap] = ['figure', 'canvas', 'figcaption']
    .map((tag) => document.createElement(tag));
  fig.style.cssText = 'margin: 0; min-width: 0';
  Object.assign(canvas, { role: 'img', ariaLabel: caption });
  renderPageToCanvas(leaf, sheet, canvas, { scale: 1240 / leaf.width });
  if (guides) {
    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: 100%; height: auto';
  cap.textContent = caption;
  fig.append(canvas, cap);
  views.append(fig);
};
figure(t({ en: 'The proof, with KDP’s guides', es: 'La prueba, con las guías de KDP' }), true);
figure(t({ en: 'The wrap as it prints', es: 'El pliego como se imprime' }), false);

coverGuideShapesは仕上がり線、折り目、各面の安全領域、バーコードの枠を用紙上のmmで返し、paintGuidesがそれを描画済みの表紙に重ねます。1枚目の図は、同じ仕上がり、紙、ページ数でKDPの計算ツールが出すテンプレートと並べて見るためのものです。PDFには本文のページが入り、そのあとに表紙用紙がそれ自身の大きさで、ガイドなしで入ります。

#6 · 計算ツールの数値と販売ページ

script.js · 382〜400行コード全体で見る
const inch = (v) => `${(v / 25.4).toFixed(3)} in`;
const both = (w, h) => `${inch(w)} × ${inch(h)} · ${w.toFixed(1)} × ${h.toFixed(1)} mm`;
const zone = (name) => built.sheet.zones.find((z) => z.name === name).rect;
const spine = built.sheets.spine.used;
const rows = [
  [t({ en: 'Interior', es: 'Interior' }), t({ en: `Black ink, cream paper · ${pages} pages`,
    es: `Tinta negra, papel crema · ${pages} páginas` })],
  [t({ en: 'Trim', es: 'Formato' }), both(W, H)],
  [t({ en: 'Full cover', es: 'Cubierta completa' }), both(built.sheet.width, built.sheet.height)],
  [t({ en: 'Spine', es: 'Lomo' }), `${inch(spine)} · ${spine.toFixed(2)} mm`],
  [t({ en: 'Back · front', es: 'Contracubierta · cubierta' }),
    both(zone('back').width, zone('back').height)],
  [t({ en: 'Bleed', es: 'Sangrado' }), `${inch(built.sheet.bleed)} · ${built.sheet.bleed} mm`],
];
// The listing: the keywords, what a phone shows of the description, and KDP's verdict.
const keywords = listingKeywords(book.metadata);
const blurb = listingPreview(listingDescription(book.metadata));
const listing = built.issues.filter((i) => i.kind.startsWith('listing'));
const bytes = (s) => new TextEncoder().encode(s).length;

表は、KDPの計算ツールが求める寸法をインチとミリで示します。販売ページの内容は本文のフロントマターから来ます。キーワードは7つで、それぞれUTF-8のバイト数をKDPの上限50と並べます。内容紹介は、スマートフォンでRead moreの手前までに見える形で示します。販売ページのチェックはこの本では何も見つけないので、パネルには緑の行が出ます。

レシピの全体

Sandbox
// ═══ Postext Cookbook · Nº 225 · A KDP paperback cover wrap with its proof and listing ═══
// https://postext.dev/en/cookbook/kdp-paperback-cover-wrap
// Code: MIT · Text: J. Valera, tr. 1886 (public domain) · Art: diffusion models
// Fonts: Spectral, Playfair Display, Work Sans (SIL OFL 1.1) · Needs postext ≥ 1.104.0
//
// Pepita Jiménez as a 6 × 9 in paperback printed by Amazon KDP on cream paper. The version
// names KDP's built-in binding profile, so the wrap comes out at KDP's measures: its bleed,
// a spine of 0.0025 in a page, the box KDP keeps on the back for its barcode. The pen draws
// the sheet as a proof with KDP's guides, lists the measures its cover calculator asks for,
// and reads the book's keywords and description against KDP's listing rules.
import { buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, inlineSvgFonts }
  from 'https://esm.sh/postext';
import { buildCover, coverGuideShapes, paintGuides, listingKeywords, listingDescription,
  listingPreview } 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 = 'kdp-paperback-cover-wrap';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// The pages' colours, then the cover's: an olive black ground, cream type, an orange gold.
const palette = { ink: '#2a2420', accent: '#9c4222', muted: '#6e6259', paper: '#fbf6ec',
  rule: '#c9b79c', night: '#1f2620', bone: '#f3ead8', gold: '#dba65a' };
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: the version names KDP's paperback profile on cream paper
// `binding` names a built-in profile: KDP's bleed (0.125 in), its spine of 0.0025 in a page
// on cream paper, its rule of no spine text under 79 pages, and the 2 × 1.2 in box on the
// back where KDP prints the barcode of the ISBN it assigns. `barcodeBy: 'printer'` keeps
// that box clear: the back's text frame ends above it, and anything the design put in it
// would be reported as `coverBarcodeZoneBusy`.
const production = {
  versions: [{ id: 'kdp', name: 'KDP paperback', binding: 'kdp-paperback-cream',
    barcodeBy: 'printer' }],
};
// The cover: an olive black ground over the whole wrap, the painting on the lower part of
// the front, and the title over the ground above it. The back takes the blurb, the spine
// the title and the author from the front matter.
const size = (width, height) => ({ x: 0, y: 0, width, height });
const cover = {
  background: col('night'),
  elements: [{ id: 'art', kind: 'image', zone: 'front', x: 0, y: 64, width: 155.6, height: 168,
    resourceId: 'orchard', fit: 'cover' }],
  verticalAlign: { back: 'middle' },

組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)

アレンジ

#KDPが認めないキーワードを入れる

bestsellingはKDPが認めない宣伝文句の一つで、緑の行がlistingKeywordBannedに変わります。juan valeraのように書名か著者の語だけでできたキーワードなら、listingKeywordInTitleが出ます。

 keywords:
   - "nineteenth-century Spanish novel"
   …
-  - "classic love story"
+  - "bestselling Spanish classic"

#本自身のバーコードを枠に入れる

本のISBNとbarcodeBy: 'book'があれば、枠はKDPのために空けず、本のバーコードで埋まります。

-  versions: [{ id: 'kdp', name: 'KDP paperback', binding: 'kdp-paperback-cream',
-    barcodeBy: 'printer' }],
+  versions: [{ id: 'kdp', name: 'KDP paperback', binding: 'kdp-paperback-cream',
+    isbn: '978-84-0000-225-1', barcodeBy: 'book' }],

#ホワイト紙に刷る

KDPのホワイト紙は1ページ0.002252インチと薄いので、同じ232ページで背幅は0.522インチになります。

-  versions: [{ id: 'kdp', name: 'KDP paperback', binding: 'kdp-paperback-cream',
+  versions: [{ id: 'kdp', name: 'KDP paperback', binding: 'kdp-paperback-white',

よくあるつまずき

  • ここのページ数は本の一部から見積もったものです。KDPはアップロードしたファイルで背幅を測るので、最終の表紙は組み終えた本から作ります。
  • デザインがバーコードの枠に置いたもの(絵、ロゴ、テキスト枠)はcoverBarcodeZoneBusyとして報告されます。KDPの白い枠がその上に刷られるからです。
  • プロファイルの数値はKDPのヘルプページから取っています。KDP自身のテンプレートと違うときはテンプレートが優先します。その背幅を版のspineOverrideに書いてください。

クレジット

レシピ
Ignacio Ferro
本文
画像
  • The cover painting: a young widow in black with a sprig of orange blossom by a fountain in an Andalusian orchard, and a seminarian among the orange trees behind her, in oils · Generated With Diffusion Models · オリジナル
フォント
Spectral (SIL OFL 1.1) · Playfair Display (SIL OFL 1.1) · Work Sans (SIL OFL 1.1)
SandboxPDF