Installations
npm install jspdf-customfonts
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
9.2.0
NPM Version
5.8.0
Score
55.4
Supply Chain
88.9
Quality
70.9
Maintenance
25
Vulnerability
95.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
230,253
Last Day
42
Last Week
438
Last Month
3,067
Last Year
38,344
GitHub Statistics
182 Stars
129 Commits
77 Forks
20 Watching
5 Branches
3 Contributors
Package Meta Information
Latest Version
0.0.4-rc.4
Package Id
jspdf-customfonts@0.0.4-rc.4
Unpacked Size
107.39 kB
Size
29.70 kB
File Count
6
NPM Version
5.8.0
Node Version
9.2.0
Total Downloads
Cumulative downloads
Total Downloads
230,253
Last day
-72%
42
Compared to previous day
Last week
-46.7%
438
Compared to previous week
Last month
7.7%
3,067
Compared to previous month
Last year
27.6%
38,344
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
jsPDF-CustomFonts-support
JsPDF is an open source that loads JavaScript in an HTML5 environment and creates a pdf document.
The current version does not support Custom Fonts. I will try to implement this feature.
Demo
It's on the GitHub Pages.
Current Version
Version 0.0.4
I do not claim to be the author of the jsPDF library, this code simply adds preliminary custom fonts support.
Version History
0.0.1 Initial proof of concept
0.0.2 Support multiline text
0.0.3 Refactor multiline text
0.0.4 Make into a plugin
Install
Download and include jspdf.customfonts.min.js.
You can also get the plugin with a package manager:
npm install jspdf-customfonts
Getting Started
This document will walk you through the basics of jsPDF and will show you how to create PDF files in the browser.
To begin with the default configuration, you should include 3 files:
- https://unpkg.com/jspdf@latest/dist/jspdf.min.js,
- dist/jspdf.customfonts.min.js,
- dist/default_vfs.js - default vfs font definition (it contains 1 Font)
- however you can use custom fonts according to the following detailed instructions :
- Run
npm install
- Copy your fonts into the fonts subdirectory.
- Run
node makeFonts.js
to create a new dist/default_vfs.js. - Include your new dist/default_vfs.js file in your code.
- Run
- however you can use custom fonts according to the following detailed instructions :
1<!DOCTYPE html> 2<html> 3 4<head> 5 <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 6 <title>jsPDF customfonts example</title> 7 <script src="https://unpkg.com/jspdf@latest/dist/jspdf.min.js"></script> 8 <script src="dist/jspdf.customfonts.min.js"></script> 9 <script src="dist/default_vfs.js"></script> 10</head> 11<body> 12...
addFileToVFS Method
1doc.addFileToVFS(fileName, Base64content);
addFont Method
1doc.addFont(fileName, fontName, fontStyle);
Example Code
1var doc = new jsPDF(); 2 3doc.addFont('NotoSansCJKjp-Regular.ttf', 'NotoSansCJKjp', 'normal'); 4 5doc.setFont('NotoSansCJKjp'); 6doc.text(15, 30, 'こんにちは。はじめまして。'); 7 8//multi-lines Test 9var paragraph = '相次いで廃止された寝台列車に代わり、いまや夜間の移動手段として主力になりつつある夜行バス。「安い」「寝ながら移動できる」などのメリットを生かすため、運行ダイヤはどのように組まれているのでしょうか。夜遅く出て、朝早く着くというメリット夜行バスを使うメリットといえば、各種アンケートでもいちばん多い回答の「安い」以外に、'; 10var lines = doc.splitTextToSize(paragraph, 150); 11doc.text(15, 60, lines); 12 13doc.save('custom_fonts.pdf'); 14
License
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/27 approved changesets -- score normalized to 0
Reason
project is archived
Details
- Warn: Repository is archived.
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Reason
65 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-6chw-6frg-f759
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-3q6f-8grx-pr4v
- Warn: Project is vulnerable to: GHSA-vh59-v9r5-4mh4
- Warn: Project is vulnerable to: GHSA-57f3-gghm-9mhc
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx
- Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94
- Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp
- Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More