Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 18, 2025

Enforce consistent resume layout rendering via Paged.js so PDF exports respect page structure and margins.

  • Paged.js injection: Bundle the Paged.js polyfill locally (no CDN) and inline it in the rendered HTML to guarantee availability without external fetches.
  • PDF generation via CLI: Generate PDFs with the Paged.js command-line renderer (pagedjs-cli), writing the rendered HTML to a temporary file and honoring a configurable timeout for layout.
  • Local fonts: Bundle Source Sans Pro locally via @fontsource/source-sans-pro and import it in styles, removing external Google Fonts links for offline-friendly, deterministic rendering.
  • Resilience & safety: Detect Paged.js across exposed globals, emit actionable fallback guidance, and keep warnings/test coverage around polyfill presence.
// src/index.tsx
<script data-enforce="pagedjs">${pagedPolyfill}</script>
Original prompt

Enforce resume redering layout using Paged.js


πŸ’‘ You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Enforce resume rendering layout using Paged.js fix: enforce Paged.js layout for resume rendering Dec 18, 2025
Copilot AI requested a review from neilime December 18, 2025 14:20
Copy link
Member

@neilime neilime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot use command line to generate pdf: https://pagedjs.org/en/documentation/2-getting-started-with-paged.js/#command-line-version

Implemented Paged.js CLI rendering for PDFs via pagedjs-cli (commit 39d07fb). The HTML is written to a temp file and rendered with the command-line tool before optimization. Screenshot: https://github.com/user-attachments/assets/338c8d54-d8b2-4dcb-aaf8-0ed1ee5b2491

Copilot AI requested a review from neilime December 18, 2025 14:29
Copy link
Member

@neilime neilime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot handle feedbacks

Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot handle feedbacks

Feedback applied: switched to pagedjs-cli-only flow, removed Puppeteer, and bundled Source Sans Pro locally via @fontsource. Latest changes in commit db99a25. Screenshot: https://github.com/user-attachments/assets/338c8d54-d8b2-4dcb-aaf8-0ed1ee5b2491

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • edgedl.me.gvt1.com
    • Triggering command: /usr/local/bin/node node install.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from neilime December 18, 2025 15:06
Copy link
Member

@neilime neilime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot handle feedbacks


const GOOGLE_FONTS =
"https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&display=swap";
const PAGEDJS_POLYFILL =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install locally as an npm deps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paged.js is now installed as a local dependency and the polyfill is inlined from node_modules (no CDN). Changes in commit 05c7ff3. Screenshot: https://github.com/user-attachments/assets/338c8d54-d8b2-4dcb-aaf8-0ed1ee5b2491

Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot handle feedbacks

Feedback addressed: Paged.js polyfill is now bundled from the local pagedjs dependency and inlined in the rendered HTML; tests updated and passing (commit 05c7ff3). Screenshot: https://github.com/user-attachments/assets/338c8d54-d8b2-4dcb-aaf8-0ed1ee5b2491

Copilot AI requested a review from neilime December 18, 2025 15:16
Co-authored-by: neilime <[email protected]>
Signed-off-by: Emilien Escalle <[email protected]>
@neilime neilime force-pushed the copilot/enforce-resume-rendering-layout branch from 05c7ff3 to 4ba80bb Compare December 18, 2025 16:35
@github-actions
Copy link
Contributor

Code Coverage Report

Coverage Results

Coverage

Metric Covered Total Percentage
Lines 206 236 87.29%
Branches 221 293 75.43%
Functions 58 63 92.06%

Overall: 87.29% 🟒
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜⬜

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