Repository navigation
Add PDF and Word processing to the browser demo - #15
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6dfe0b68c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (typeof item.str !== 'string') continue; | ||
| const y = item.transform?.[5]; | ||
| if (line && lastY !== null && Number.isFinite(y) && Math.abs(y - lastY) > 3) { pageText += line.trim() + '\n'; line = ''; } | ||
| line += (line && !line.endsWith(' ') ? ' ' : '') + item.str; |
There was a problem hiding this comment.
Preserve spacing between adjacent PDF text runs
When a PDF splits a word or punctuation across text items, such as at a font change, this unconditionally inserts a space even when the items are contiguous on the page. For example, adjacent pass and word items become pass word; separate Q and : items become Q :, which the browser draft engine no longer recognizes as a question prefix. This silently changes imported source content and can prevent FAQ extraction. Preserve explicit whitespace and use item positions and widths to distinguish actual word gaps from contiguous text runs.
Useful? React with 👍 / 👎.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Enable browser-only PDF and Word (.docx) import/export on the existing portfolio demo while preserving the Java application's source and server endpoints.
The browser adapter extracts PDF text with PDF.js and Word main-document XML via bounded JSZip streaming, and generates paginated PDF-LIB/Word exports. Keep 5 MB/50-page/50,000-character import limits, reject unsupported inputs, preserve Unicode in Word, explain unsupported PDF glyphs, and export every FAQ regardless of filters. Library versions are pinned and lazy-loaded from jsDelivr; document content is not uploaded. The existing revision guards discard late import/export results after edits or clearing.
Restore the PDF/Word choices in the generated site, add document-library disclosure/attribution, and update README and guides.
Validation: 60 JavaScript tests pass locally; static build, syntax checks and diff checks pass. Real PDF and DOCX imports and export completion verified through browser UI. Real exported files were also generated with the adapter against the actual libraries, rendered, and visually inspected across three pages each. The browser download event was not captured by the preview automation, so binary-file integrity/layout was checked separately with the same exporter. CI runs Java/JavaScript verification and the demo build. Public-domain verification follows website deployment.