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
selfgetBookmarks()
Read existing bookmarks from the PDF.
public
getBookmarks() : array<int, BookmarkEntry>
Return values
array<int, BookmarkEntry>getPageCount()
public
getPageCount() : int
Return values
intgetReader()
public
getReader() : PdfReader
Return values
PdfReadergetVersionWarnings()
public
getVersionWarnings() : array<int, string>
Return values
array<int, string>hasBookmarks()
public
hasBookmarks() : bool
Return values
boolopen()
public
static open(string $path[, string $password = '' ]) : self
Parameters
- $path : string
- $password : string = ''
Return values
selfopenString()
public
static openString(string $pdfBytes[, string $password = '' ]) : self
Parameters
- $pdfBytes : string
- $password : string = ''
Return values
selfremoveBookmarks()
Remove all bookmarks from the document.
public
removeBookmarks() : self
Return values
selfsave()
public
save(string $path) : void
Parameters
- $path : string
setBookmarks()
Replace all bookmarks with the given entries.
public
setBookmarks(BookmarkEntry ...$entries) : self
Parameters
- $entries : BookmarkEntry
Return values
selftoBytes()
public
toBytes() : string