Skip to content

Novis\Pdf\Reader

An existing PDF file opened for reading: its page count, its metadata, its attached files and its text. Every string and bytes value it returns is tainted, because it comes from the file.

Members

4 members.

MemberSignature
openopen(Core\Bytes::Source $pdf): Reader
attachmentsattachments(): array<Attachment>
invoiceXmlinvoiceXml(): ?tainted string
texttext(uint $page): tainted string

Types

Metadata

type Metadata = {    title: ?tainted string,    author: ?tainted string,    subject: ?tainted string,    keywords: ?tainted string,    creator: ?tainted string,    producer: ?tainted string,};

Attachment

type Attachment = { name: tainted string, data: tainted bytes };

Properties

  • $reader->pageCountuintthe number of pages in the PDF file
  • $reader->metadataMetadatathe title, author, subject, keywords, creator and producer of the file. Each one is null when the file does not have it.

Example apps

These complete apps use this class. You can download and run each one.

  • PDF documents: A small web app that makes three PDF files. They are an invoice, an encrypted report and event tickets. See each file, then run the app and its tests.