phpdftk API Documentation

BookmarkEditor
in package

FinalYes

Add, replace, read, or remove PDF bookmarks (outlines).

Usage: BookmarkEditor::open('report.pdf') ->setBookmarks( new BookmarkEntry('Chapter 1', 1), new BookmarkEntry('Chapter 2', 5, [ new BookmarkEntry('Section 2.1', 5), new BookmarkEntry('Section 2.2', 8), ]), ) ->save('bookmarked.pdf');

Table of Contents

Methods

addBookmark()  : self
Add a single bookmark (appended to existing bookmarks).
getBookmarks()  : array<int, BookmarkEntry>
Read existing bookmarks from the PDF.
getPageCount()  : int
getReader()  : PdfReader
getVersionWarnings()  : array<int, string>
hasBookmarks()  : bool
open()  : self
openString()  : self
removeBookmarks()  : self
Remove all bookmarks from the document.
save()  : void
setBookmarks()  : self
Replace all bookmarks with the given entries.
toBytes()  : string

Methods

addBookmark()

Add a single bookmark (appended to existing bookmarks).

public addBookmark(string $title, int $pageNumber) : self
Parameters
$title : string
$pageNumber : int
Return values
self

getVersionWarnings()

public getVersionWarnings() : array<int, string>
Return values
array<int, string>

open()

public static open(string $path[, string $password = '' ]) : self
Parameters
$path : string
$password : string = ''
Return values
self

openString()

public static openString(string $pdfBytes[, string $password = '' ]) : self
Parameters
$pdfBytes : string
$password : string = ''
Return values
self

removeBookmarks()

Remove all bookmarks from the document.

public removeBookmarks() : self
Return values
self

save()

public save(string $path) : void
Parameters
$path : string

        
On this page

Search results