pdf-outlines
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

给 PDF 文件添加书签目录

addOutlines

const fs = require("fs");
const { addOutline } = require("../build/index");
const path = require("path");

addOutline({
  filePath: path.join(__dirname, "test.pdf"),
  outputFilePath: path.join(__dirname, "test-with-outline.pdf"),
  outlines: [
    {
      title: "一、文章标题balabala",
      to: 0, // 注意 to 从 0 开始
      children: [
        {
          title: "1.1 文章子标题balabala",
          to: 1,
        },
        {
          title: "1.2 文章子标题balabala",
          to: 2,
        },
      ],
    },
    {
      title: "二、文章标题balabala",
      to: 3,
    },
  ],
});

Readme

Keywords

none

Package Sidebar

Install

npm i pdf-outlines

Weekly Downloads

1

Version

2.0.1

License

ISC

Unpacked Size

2 MB

Total Files

13

Last publish

Collaborators

  • hangaoke