New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pdfmake-font-generator

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdfmake-font-generator

Generates fonts to use in the pdfmake package

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-0.39%
Maintainers
1
Weekly downloads
 
Created
Source

pdfmake-font-generator

CLI to generate custom fonts to use them with pdfmake

Installation

You can install it locally as a dev dependency, since it is only used to generate your custom fonts

$ npm install pdfmake-font-generator --save-dev

or globally

$ npm install -g pdfmake-font-generator

Usage

Once installed, you can run the command pdfmakefg which receives two arguments, the first one is the directory where your custom fonts are located and the second one is the name of the file (output) that will be generated. This generated file contains your custom fonts and this one is you need to import in your pdfmake project.

$ pdfmakefg /path/of/your/custom/fonts /path/of/the/output/file.js

Internally, this script generates an object where each key is the name of the file and its value is the corresponding content.

NOTE: The first argument is a DIRECTORY and the second one is a filename (it's important to create the file with .js extension). The file will be generated in the given path. If an error is thrown, create the file manually.

Example

In the root project there is a my-fonts directory which contains the font files (example: Roboto-Regular.ttf) and a pdf directory which contains another one called fonts. Now you run the command:

$ pdfmakefg ./my-fonts ./pdf/fonts/custom-fonts.js

The script gets all the font files into the my-fonts directory, then it proccesses these files and generates a custom-fonts.js file in the /pdf/fonts/ directory. Now, you can import the generated fonts in your project.

// If you use pdfmake
import pdfMake from "pdfmake/build/pdfmake";
// instead of import the default fonts  (import pdfFonts from "pdfmake/build/vfs_fonts";), you import your custom fonts
import pdfFonts from "./pdf/fonts/custom-fonts"; // The path of your custom fonts
pdfMake.vfs = pdfFonts.pdfMake.vfs;

You can learn more about custom fonts here

Keywords

FAQs

Package last updated on 07 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc