Git Product home page Git Product logo

pdf-generator's People

Contributors

chieforz avatar renovate[bot] avatar

Watchers

 avatar  avatar  avatar

pdf-generator's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update external-non-major (@types/node, knip, puppeteer-core, tsx)

Detected dependencies

github-actions
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • alstr/todo-to-issue-action v1.3-beta
npm
package.json
  • @pdf-lib/fontkit ^1.1.1
  • debug ^4.3.5
  • express ^4.19.2
  • fast-glob ^3.3.2
  • locate-chrome ^0.1.1
  • pdf-lib ^1.17.1
  • puppeteer-chromium-resolver ^22.0.0
  • puppeteer-core ^22.11.0
  • puppeteer-report ^3.1.0
  • typescript ^5.4.5
  • yargs ^17.7.2
  • @biomejs/biome ^1.8.1
  • @chieforz/biome-config ^1.3.0
  • @chieforz/eslint-config-tslint-base ^1.3.0
  • @commitlint/cli ^19.3.0
  • @commitlint/config-conventional ^19.2.2
  • @release-it/conventional-changelog ^8.0.1
  • @types/conventional-changelog ^3.1.5
  • @types/debug ^4.1.12
  • @types/express ^4.17.21
  • @types/node ^20.14.2
  • @types/semver ^7.5.8
  • @types/yargs ^17.0.32
  • conventional-changelog ^6.0.0
  • conventional-changelog-conventionalcommits ^8.0.0
  • eslint ^9.5.0
  • husky ^9.0.11
  • knip ^5.20.0
  • lint-staged ^15.2.7
  • npm-run-all2 ^6.2.0
  • release-it ^17.3.0
  • semver ^7.6.2
  • tsx ^4.15.5
  • wireit ^0.14.4
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

Find a way to inject fonts that are loaded on webs...

Find a way to inject fonts that are loaded on websites

// TODO: Find a way to inject fonts that are loaded on websites

    await Promise.all(canvasToImagePromises);
  }
  if (args.debug === 'url') {
    process.stdout.write(url);
  }
  if (!args.debug) {
    // @ts-ignore
    const pdfContent = await report.pdfPage(page, pdfOptions);

    await browser.close();
    if (server) await server.close();
    debug('Closed chrome instance and express server');

    const finalPdf = await PDFDocument.create();
    if (pathToStaticFiles) {
      finalPdf.registerFontkit(fontkit);
      const fontsToInclude = await glob(
        path.join(pathToStaticFiles, '**', '*.ttf')
      );
      await Promise.all(
        fontsToInclude.map(async (fontToInclude) => {
          const fontBytes = await fs.promises.readFile(fontToInclude);
          return finalPdf.embedFont(fontBytes);
        })
      );
    } else {
      // TODO: Find a way to inject fonts that are loaded on websites
    }

    const content = await PDFDocument.load(pdfContent);
    const contentPages = await finalPdf.copyPages(
      content,
      content.getPageIndices()
    );
    for (const contentPage of contentPages) {
      finalPdf.addPage(contentPage);
    }

    const pdfBytes = await finalPdf.save();

    if (args.outputPath) {
      const outputPath = path.isAbsolute(args.outputPath)
        ? args.outputPath
        : path.join(process.cwd(), args.outputPath);
      try {
        await lstat(outputPath);
      } catch (_) {
        await mkdir(outputPath.substring(0, outputPath.lastIndexOf(path.sep)), {
          recursive: true,
        });
      }
      debug('Writing file at', args.outputPath);
      await writeFileAsync(args.outputPath, pdfBytes);
      debug('PDF generation has been successfully finished!');
      return args.outputPath;
    }

    debug('Return pdf content to stdout');
    return pdfBytes;
  }
};

export default pdfGenerator;
eleted file mode 100644
ndex 4db3c18..0000000
++ /dev/null

78f88a675283aab6c4f769fcb75606b090bff005

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.