Skip to content

feat: add client-side PDF, PowerPoint and Markdown export - #72

Merged
DevSecNinja merged 7 commits into
mainfrom
copilot/feat-add-pdf-powerpoint-export
Jun 19, 2026
Merged

feat: add client-side PDF, PowerPoint and Markdown export#72
DevSecNinja merged 7 commits into
mainfrom
copilot/feat-add-pdf-powerpoint-export

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Adds PDF, PPTX and Markdown export of the GRIP → Microsoft mapping directly in the browser — no data leaves the client. All three formats produce one fully-detailed page/slide/section per GRIP measure.

Approach

PDF — a screen-hidden PrintDocument component (always mounted) renders one full page per GRIP measure; a @media print stylesheet hides the interactive app and reveals only this document, so "Save as PDF" yields a measure-per-page deck (with a cover page) rather than the on-screen view. exportPDF() delegates to window.print().

PPTX — uses pptxgenjs (4.0.1, no known vulnerabilities) to programmatically build a .pptx in-browser:

  • Branded title slide
  • One slide per GRIP measure in a two-column layout (guidance left; mapping + standards + references right) with shrink-to-fit text, using the existing UI colour language

MarkdownexportMarkdown(lang) builds a single .md document with one section per GRIP measure and triggers a client-side download via a Blob (no dependency, no data leaves the browser).

Each page (PDF), slide (PPTX) and section (Markdown) carries the complete measure detail shown in the app: title, summary, type/basis/tier, practical guidance (why / do / don't), the Microsoft mapping with documentation URLs, the standards mapping with the "why" and control references, and further-reading references.

UI

ExportMenu dropdown added to AppHeader next to the language selector — accessible (ARIA menu/menuitem roles, Escape to close, outside-click dismiss), spinner shown during PPTX generation. The dropdown offers PDF, PowerPoint and Markdown options.

// AppHeader now renders:
<ExportMenu lang={lang} />

i18n

exportLabel, exportPdf, exportPptx, exportMarkdown, exportPdfAria, exportPptxAria, exportMarkdownAria added to all three locales (NL/EN/FR) in src/i18n/strings.js.

Tests & housekeeping

  • Added tests for exportPDF, exportPPTX (all locales), exportMarkdown (all locales + full-detail content), the ExportMenu component (including the Markdown option), and the PrintDocument full-detail rendering; the PPTX test mocks writeFile and the Markdown test mocks URL.createObjectURL/click so generation never touches disk.
  • Removed an accidentally committed GRIP-Visualizer.pptx artifact and gitignored *.pptx.
  • Re-scoped three existing App tests to the detail aside since section labels now repeat per print page.
  • Merged the latest main (self-assessment mode), keeping both the PrintDocument and AssessmentScorecard integrations in src/App.jsx.

- Install pptxgenjs@4.0.1 for client-side PPTX generation
- Add exportPDF() (window.print) and exportPPTX(lang) in src/data/export.js
- Add ExportMenu dropdown component in src/components/ExportMenu.jsx
- Mount ExportMenu in AppHeader next to the language selector
- Add NL/EN/FR i18n strings for the export feature
- Add @media print CSS to hide chrome when printing to PDF
- Add 8 tests covering exportPDF, exportPPTX (all languages), and ExportMenu

Closes #19
Copilot AI changed the title [WIP] Add ability to export visualizer content to PDF and PowerPoint feat: add client-side PDF and PowerPoint export Jun 18, 2026
Copilot AI requested a review from DevSecNinja June 18, 2026 15:55
@DevSecNinja
DevSecNinja marked this pull request as ready for review June 18, 2026 18:45
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🔍 Preview deployed: https://2bc2c95b.grip-visualizer.pages.dev

Updated: Fri, 19 Jun 2026 08:59:22 GMT

@DevSecNinja

Copy link
Copy Markdown
Owner

@copilot The PDF export is not that useful as it is now. I like the PPTX export:

  • Can you make sure the PDF export is just like the PPTX export with a page per measurement?
  • Can you make sure that everything that is in the measurement, is also on the page for both PPTX & PDF? E.g. some measurements have a lot of good info:
T1
Technisch
Basis 2
×
Voorzie een eigen domeinnaam
Gebruik een eigen, geverifieerde domeinnaam voor je digitale identiteit.

Praktische richtlijnen
Waarom dit belangrijk is: Een eigen, geverifieerd domein geeft je controle over je identiteit en de levenscyclus ervan. Leun je op een gratis of gedeeld domein van een provider, dan kun je MFA/voorwaardelijke toegang niet afdwingen, mis je SPF/DKIM/DMARC tegen phishing en spoofing, en verlies je accounts als je van provider wisselt.

Wel doen
Registreer en verifieer je eigen domein en gebruik het voor identiteiten en e-mail.
Configureer SPF, DKIM en DMARC om spoofing te voorkomen.
Houd domeinregistratie en DNS in beheer van de organisatie, niet van één persoon.
Niet doen
Bouw je identiteit niet op een gratis of gedeeld providerdomein dat je niet beheert.
Laat domein- of DNS-eigenaarschap niet zonder toezicht bij één individu of externe partij liggen.
Microsoft-koppeling
Microsoft 365 — Add a custom domain
A1
[Documentatie openen ↗](https://learn.microsoft.com/microsoft-365/admin/setup/add-domain)
Koppeling met standaarden
Waarom deze koppeling: Een eigen, geverifieerd domein is de basis voor identiteits- en toegangsbeheer, en daarmee voor de toegangsbeheermaatregelen die NIS2 21(2)(i) verwacht.

[NIS2 Directive (EU) 2022/2555 ↗](https://eur-lex.europa.eu/eli/dir/2022/2555/oj)
21(2)(i)
Indicatieve koppeling met veelgebruikte controlekaders; geen 1-op-1-relatie en niet uitputtend.

- Add PrintDocument component: screen-hidden, one full page per measure
  (title, summary, guidance why/do/don't, Microsoft mapping + docs URLs,
  standards mapping + controls), revealed only via @media print
- Rework exportPDF to use the PrintDocument instead of printing the view
- Expand PPTX slides to a two-column layout carrying the same full detail
- Mock writeFile in the PPTX test; remove accidental GRIP-Visualizer.pptx
  artifact and gitignore *.pptx
- Re-scope three App tests to the detail aside (labels now repeat per page)

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot The PDF export is not that useful as it is now. I like the PPTX export:

  • Can you make sure the PDF export is just like the PPTX export with a page per measurement?
  • Can yo...

Done in 28de4a7 (latest commit).

  • PDF is now page-per-measure like the PPTX. A new screen-hidden PrintDocument renders one full page per measure and @media print reveals only that, so "Save as PDF" gives a measure-per-page deck rather than the on-screen view.
  • Both PDF and PPTX now carry the complete measure detail: practical guidance (why / do / don't), the Microsoft mapping with documentation URLs, and the standards mapping with the "why" and control references. I verified against your T1 example — the generated slide/page includes the SPF/DKIM/DMARC do-items, "Add a custom domain" (A1) with its docs link, and NIS2 21(2)(i).

@DevSecNinja

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

…powerpoint-export

# Conflicts:
#	src/App.jsx

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflict with main in 245bd70. The only conflict was in src/App.jsx (both branches added an import) — I kept both PrintDocument (this PR's PDF export) and AssessmentScorecard (the new self-assessment mode from main). Lint passes and all 40 tests pass on the merged result.

@DevSecNinja

Copy link
Copy Markdown
Owner

@copilot This is super cool! Can you also add a Markdown export please that includes all that info that we now have in PDF and PPTX too?

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot This is super cool! Can you also add a Markdown export please that includes all that info that we now have in PDF and PPTX too?

Added a Markdown export in the latest commit. It's now the third option in the Export dropdown and produces a single .md file with one section per GRIP measure carrying the same full detail as the PDF/PPTX exports: practical guidance (why / do / don't), the Microsoft mapping with documentation links, the standards mapping with the "why" and control references, and further-reading links. Like the other exports it runs entirely in the browser — no data leaves the client. Labels and ARIA added for NL/EN/FR, with tests covering all locales and the content. Lint passes and all 42 tests pass.

Copilot AI changed the title feat: add client-side PDF and PowerPoint export feat: add client-side PDF, PowerPoint and Markdown export Jun 19, 2026
@DevSecNinja
DevSecNinja merged commit 8bf6ce7 into main Jun 19, 2026
22 checks passed
@DevSecNinja
DevSecNinja deleted the copilot/feat-add-pdf-powerpoint-export branch June 19, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants