# PDFs

## PDF files shown as previews in a grid, such as menus, price lists and brochures.

## Basics: what module-pdfs is

**module-pdfs** is the PDF variant of the portfolio engine in CCMS and is used to show documents in a card grid.

Typical use cases are reports, price lists, menus, manuals and other documents that should be readable directly on the page.

The module is easy to maintain because its content is driven by the same `portfolio` structure as the other media variants.

## Option 1: top level and items structure

The top level lives in `portfolio` with `module_type: "module-pdfs"`, along with the usual fields such as `id`, `aria_label`, `columns`, `section_title` and `background.*`.

The content lives in `items[]`. Each item normally uses `display`, `appearance`, `is_pdf`, `src`, `alt` and `text_html`.

Translation layers follow the pattern `<lang>_portfolio`.

## Option 2: is_pdf and iframe behaviour

When `is_pdf=true`, the card is rendered as an `<iframe>` with `src + #toolbar=0&navpanes=0&scrollbar=0&view=FitH`.

This gives an embedded preview of the PDF in the portfolio card without the full PDF interface.

If `is_pdf=false`, the same item goes through the image branch instead, with `<picture>` and image manifest fields.

## Option 3: columns, cards and PDF ratio

The grid uses `portfolio.columns` via the CSS variable `--cols` and becomes multi-column on larger screens.

The PDF frame has its own class, `.portfolio-frame`, with `aspect-ratio: 210 / 297`, which matches A4 proportions.

`appearance` per item also works for PDF cards and is compiled into `auto_class`/ `auto_style`.

## Option 4: compiler flow and dynamic items

The build expands `portfolio.items[]` into `portfolio.media1..mediaN` through the general array normalisation.

Core rendering materialises every expanded item, so `items[]` has no fixed limit of twelve. Choose the practical number based on the page's performance, accessibility and usability instead.

`portfolio.auto_display` is set automatically from the visible media items, which controls whether the section is rendered.

## Option 5: schema, SEO and AI optimisation

For PDF collections, `ItemList` is a good base, with one document object per item (e.g. `DigitalDocument`, `Report` or `Menu`, depending on the content).

Each document should have a clear title/description and an `encoding` with `MediaObject` and `encodingFormat: application/pdf`.

The visible text in the cards and the schema descriptions should say the same thing, for stronger AI and search signals.
