w3c / w3c/vc-render-method

Discuss PDF rendering expectations.

Open
#53 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
9
Forks
8
Avg merge
14d 42m
Merged PRs (30d)
2

Description

#49 proposes removing the current pdf-mustache approach to "rendering PDFs" from the current specification text with the plan to lean on the new "sandboxed HTML" approach. However, it's not clear from either the past or the proposed future what the expected rendering / experience might be.

Is the expectation that a PDF will be displayed within the Wallet/Renderer UX? or offered for download? or sent to a printer? or all of the above?

In recent tests, the sandboxed iframe environment prevents many of the approaches typically used to do "HTML to PDF". For example html2pdf.js completely fails due to being unable to clone HTML within a sandboxed iframe.

That said, other options exist for doing PDF creation in JavaScript, they just avoid HTML (and therefore HTML-based templates). For example, pdfmake uses a JSON structure to create PDFs. See the pdfmake playground for examples of what's possible there.

I've got some demo code in progress for using pdfmake, however, because the sandboxed iframe cannot create another iframe within itself--nor use <embed>, <object>, etc. the browser-based PDF renderers cannot be used to render the application/pdf that's generated. It can, however, be linked do as a download.

Consequently, to fully display a PDF generated from within the sandboxed iframe, the sandboxed iframe would need to send back (via postMessage) the generated application/pdf and allow the Wallet/Renderer to do the display. However, doing that "voids the warranty" of the sandbox a bit because PDFs may contain server-side communication and make network requests.

Which brings me back to the main question around expectations of display/experience with PDFs in Wallets/Renderers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #49 and the current and proposed specification text, then review the sandboxed iframe constraints described here, including PDF download, display, printing, and postMessage options. Done means the Wallet/Renderer PDF experience and its security boundaries are explicitly agreed and reflected in the specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
frontend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.