![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
pdfmake-font-generator
Advanced tools
CLI to generate custom fonts to use them with pdfmake
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
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.
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
FAQs
Generates fonts to use in the pdfmake package
The npm package pdfmake-font-generator receives a total of 1,460 weekly downloads. As such, pdfmake-font-generator popularity was classified as popular.
We found that pdfmake-font-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.