xref: /plugin/totext/vendor/prinsfrank/pdfparser/docs/14.3-associated-files.md (revision b4ecfc82b02c9a76205381a28b47006474ccf569)
1# Associated Files
2
3File specifications can be linked to several types of objects using "associated files".
4
5## Retrieving files associated with a document (14.13.3)
6
7To get all files associated with the document, use the `getFileSpecifications` method on the `Catalog` object. To retrieve the `Catalog` object, use the `getCatalog` method on the `Document` object.
8
9```php
10/** @var \PrinsFrank\PdfParser\Document $document */
11$catalog = $document->getCatalog();
12
13/** @var \PrinsFrank\PdfParser\Document\Object\Decorator\Catalog $catalog */
14$associatedFiles = $catalog->getFileSpecifications();
15```
16
17## Retrieving files associated with a page (14.13.4)
18
19To get all files associated with a page, use the `getFileSpecifications` method on the `Page` object. To retrieve the `Page` object, use the `getPage` method on the `Document` object.
20
21```php
22/** @var \PrinsFrank\PdfParser\Document $document */
23$page = $document->getPage(1);
24
25/** @var \PrinsFrank\PdfParser\Document\Object\Page $page */
26$associatedFiles = $page->getFileSpecifications();
27```
28