Skip to main content

Read metadata

import { PDFEngines } from "chromiumly";

const metadataBuffer = await PDFEngines.readMetadata([
  "path/to/file_1.pdf",
  "path/to/file_2.pdf",
]);
Returns a buffer containing the metadata (format depends on Gotenberg). Typically used for inspection or debugging.

Write metadata

import { PDFEngines } from "chromiumly";

const buffer = await PDFEngines.writeMetadata({
  files: ["path/to/file_1.pdf", "path/to/file_2.pdf"],
  metadata: {
    Author: "Your Name",
    Title: "Document Title",
    Keywords: ["pdf", "chromiumly"],
  },
});
The metadata object uses standard PDF/XMP field names. For a full list of supported keys, see ExifTool PDF/XMP tag names.

Read bookmarks

import { PDFEngines } from "chromiumly";

const bookmarksBuffer = await PDFEngines.readBookmarks([
  "path/to/file_1.pdf",
  "path/to/file_2.pdf",
]);
Returns a JSON buffer containing bookmarks for each input file.

Write bookmarks

import { PDFEngines } from "chromiumly";

const updated = await PDFEngines.writeBookmarks({
  files: ["path/to/file_1.pdf"],
  bookmarks: [
    {
      title: "Chapter 1",
      page: 1,
      children: [],
    },
  ],
});
bookmarks accepts either a list applied to all files or a filename-to-list map.