Skip to content

fix(pdf): a PDF error shows a message instead of freezing; fall back to the default font (6.4.x) - #254

Closed
RensTillmann wants to merge 1 commit into
release/6.4.xfrom
fix/64-pdf-error-handling
Closed

RensTillmann wants to merge 1 commit into
release/6.4.xfrom
fix/64-pdf-error-handling

Conversation

@RensTillmann

@RensTillmann RensTillmann commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two PDF Generator fixes for 6.4:

  1. A PDF error no longer leaves the form stuck on "Generating PDF file...". Every failure path now calls a new SUPER.pdf_generator_abort(): rejected html2canvas renders (page render and the flag-image render in prepare, both had no .catch), JavaScript errors while building a page (the catch only logged), and errors in init, prepare and page determination. Abort logs to the console, restores the form and the submit button, shows a translatable message with the Close button, and sends nothing. Message: "We couldn't create the PDF, so your form has not been sent yet. Please try again." (new loadingOverlay.pdf_generation_error). It runs once; a render that finishes after an abort does not submit; an error from the submit step after the PDF is done is not shown as a PDF error.
  2. Non-Latin PDF languages no longer hang when the font file fails to load. The font fetch is retried once; if it still fails, a console warning is written and the PDF is built with the default font (before: no else branch, the PDF never started). The shared prepare chain moved into SUPER.pdf_generator_start() so both branches use it.

No timeout was added. Debug mode is unchanged (already does not submit on 6.4).

Part of #102. The 6.3 LTS counterpart is #251.

Base branch

release/6.4.x: bug fixes for the beta channel (frozen: security and bug fixes only).

Tests

node --test tests/test-pdf-generator-client.cjs (real common.js functions in node:vm with stubs):
  without the fix: 11 of 14 fail
  with the fix:    14 of 14 pass
all client tests: 57 pass, 0 fail
php -l src/super-forms.php: no syntax errors
full PHPUnit suite (g16-phpunit:wp7.1.1-php8.2 + MariaDB 11.4): OK, 612 tests, 10285 assertions, 1 skipped

Not run: a real-browser PDF submission. src/docs/changelog.md adds "Unreleased - Version 6.4.010-beta"; #250 adds the same heading, so expect a one-line changelog conflict when both land.

Merge

Draft: for QA and the next 6.4.0xx release session.

@RensTillmann

Copy link
Copy Markdown
Owner Author

The fix is already released in 6.4.010 (release PR #299, merged 21 Oct 2026): SUPER.pdf_generator_abort and the font retry/default-font fallback are in src/assets/js/common.js (from line 11752); the code is identical apart from comments. This PR's test file tests/test-pdf-generator-client.cjs was not part of that release and stays on this branch. The browser suite covers this on 6.4.010 (pdf-error-and-debug.spec.ts, passed).

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.

1 participant