jsPDF-CustomFonts-support icon indicating copy to clipboard operation
jsPDF-CustomFonts-support copied to clipboard

How to support and add multiple font files?

Open ashakoshti1988 opened this issue 7 years ago • 6 comments

Hi,

As i want to use google Noto and Google CJK fonts for PDF generation.but all have different ttf files.so how i can i convert and give single ttf base 64 encoded files to jspdf custom font support? please help,as this is urgent. @sphilee

ashakoshti1988 avatar Nov 06 '17 12:11 ashakoshti1988

@ashakoshti1988

  1. Download this project.
  2. Copy your fonts into the ./fonts subdirectory.
  3. Run node makeFonts.js to create a new ./dist/default_vfs.js.
  4. Include your new ./dist/default_vfs.js file in your code.

If not, please ask me again.

sphilee avatar Nov 06 '17 13:11 sphilee

@sphilee i have downloaded project from release which is rc.5 .now i am not able to find ./fonts directory in that.even not able to find makeFonts.js in any subfolders..please specify which project are you talking about.or provide me the link to download?

@sphilee

ashakoshti1988 avatar Nov 07 '17 05:11 ashakoshti1988

Could you download version rc.6? @ashakoshti1988

sphilee avatar Nov 07 '17 05:11 sphilee

yes got it..but my question is different.like first i used arial unicode fonts,which was having all characters of unicode.so only once i have to set

doc.setFont('Arial Unicode');
doc.text(15, 15, '안녕하세요 만나서 반갑습니다.');

now,Arial unicode is commercial one.so for my application redistribution i can't use that.for that i need single ttf file to supply for pdf generation.because in my application there will be mixture of characters of different languages and everytime i can't check each character and set the font accordingly.as it will be huge characeter set to export in pdf.so tell me how can i support and merge multiple font files in vfs_fonts.js? @sphilee

ashakoshti1988 avatar Nov 07 '17 06:11 ashakoshti1988

@ashakoshti1988 Um ... you want to create one font file that supports all languages, right? But Arial Unicode is not commercially available. So how about using this package to merge multiple fonts into a single ttf file? https://www.npmjs.com/package/fonteditor-core

sphilee avatar Nov 08 '17 10:11 sphilee

Tried adding the Chinese font files. After incorporation the custom Chinese font files. The characters which the PDF gives as output has lot of characters missing.

All the chinese characters are not getting processed and printed in PDF.

ankitcts avatar Dec 26 '17 14:12 ankitcts