Skip to content

Added docx to pdf converter#147

Draft
SteRiccio wants to merge 6 commits into
masterfrom
feat/docx-to-pdf-converter
Draft

Added docx to pdf converter#147
SteRiccio wants to merge 6 commits into
masterfrom
feat/docx-to-pdf-converter

Conversation

@SteRiccio
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a DOCX→PDF conversion utility to the server codebase and exposes it via the existing utils and package entrypoint exports.

Changes:

  • Added DocxConverter.convertDocxToPdf that uses mammoth (DOCX→HTML) + puppeteer (HTML→PDF).
  • Exported DocxConverter through src/utils/index.ts and src/index.ts.
  • Added new runtime dependencies (mammoth, puppeteer) and updated lockfile accordingly.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/utils/docxConverter.ts New DOCX-to-PDF converter implementation using Mammoth + Puppeteer.
src/utils/index.ts Re-exports the new DocxConverter utility.
src/index.ts Exposes DocxConverter from the package entrypoint.
package.json Adds mammoth and puppeteer runtime dependencies.
yarn.lock Lockfile updates for the new dependencies and transitive upgrades.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/docxConverter.ts Outdated
Comment thread src/utils/docxConverter.ts Outdated
Comment thread src/utils/docxConverter.ts
Comment thread src/utils/docxConverter.ts Outdated
Comment thread package.json
@SteRiccio SteRiccio requested a review from Copilot May 11, 2026 13:43
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Comment on lines +11 to +15
const pageLoadTimeoutMs = 15000
const parsedMaxConcurrency = Number(process.env.DOCX_PDF_MAX_CONCURRENCY ?? 2)
const maxPdfConversionsInParallel =
Number.isFinite(parsedMaxConcurrency) && parsedMaxConcurrency > 0 ? Math.floor(parsedMaxConcurrency) : 2

Comment on lines +49 to +56
const launchBrowser = async (): Promise<Awaited<ReturnType<typeof puppeteer.launch>>> => {
const forceNoSandbox = process.env.PUPPETEER_NO_SANDBOX === 'true'

if (forceNoSandbox) {
return puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
})
@SteRiccio SteRiccio marked this pull request as draft May 15, 2026 08:31
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