Skip to content

"warning: name is too long" when CMYK is enabled with long filename and ID #732

@u1f992

Description

@u1f992

ファイル名(拡張子含む)と内部で使用するIDの合計文字数が52字以上の原稿でCMYK機能を有効にするとwarning: name is too long警告が発生します。

sum52.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>a</title>
  </head>
  <body>
    <h1 id="sum52-id-42-chars_________________________">a</h1>
    <p><a href="#sum52-id-42-chars_________________________">a</a></p>
  </body>
</html>
vivliostyle.config.js
export default {
  entry: ["sum52.html"],
  pdfPostprocess: { cmyk: true },
};
$ npx @vivliostyle/cli@10.3.0 build
INFO Start building
INFO Launching PDF build environment
INFO Building pages
INFO Building PDF
INFO Processing PDF
INFO Converting CMYK colors
▁║▁  Processing PDFwarning: name is too long
WARN RGB color not mapped to CMYK: {"r":0,"g":0,"b":0}
WARN RGB color not mapped to CMYK: {"r":0,"g":0,"b":9333}
SUCCESS Finished building output.pdf
📙 Built successfully!

警告はMuPDFのこの箇所から出力されています。PDF 1.x系の仕様では名前(PDFの基本データ型)の長さは127バイト以下にするように推奨されており、MuPDFはその互換性のため切り詰めを実装しているようです。

一方でChromiumは127バイト以上の長さの名前を含むPDFを生成します。今回の例では/viv-id-http:003a:002f:002flocalhost:003a13000:002fvivliostyle:002fsum52:002ehtml:0023sum52-id-42-chars_________________________(128バイト)という名前が生成され、警告を発生させています。


  • PDF 1.4 Appendix C "Implementation Limits": "applications producing PDF files are strongly advised to remain within them" (not a hard requirement)
  • PDF 1.7 Annex C "Implementation Limits": "conforming writers producing PDF files should remain within them"
  • PDF 2.0 Annex C "Advice on Maximising Portability": "In previous versions of PDF, it was recommended that the maximum length of the internal representation of a name object was limited 127 bytes."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions