Technical Support
🟢 Online now
Hello 👋

How can we help you today?
Contact on WhatsApp
B4X Store
← All libraries
PDF B4J · Java 19 · v1.0

B4JPdf Pro

Guides for PDF generation, transformations, viewing, forms, P12/PFX digital signatures and multilingual fonts in B4J.

Unicode & CJK
v1.0 documentation

Unicode, Chinese and Noto CJK fonts

B4JPdf Pro loads TrueType fonts through LoadTTFFont. Character support depends on actual font coverage: the built-in PDF fonts do not support every script.

Fonts supplied

  • Noto Sans SC: Simplified Chinese; primary font.
  • Noto Sans TC: Traditional Chinese; optional pack.
  • Noto Sans JP: Japanese; optional pack.
  • Noto Sans KR: Korean; optional pack.

Licenses and instructions are included in Noto-CJK-OFL.txt and NotoCJK-Optional-Pack-README.txt. Extract TC/JP/KR from NotoCJK-Optional-Pack.zip before loading.

Example: load and check coverage

Dim pdf As PDFManager
pdf.Initialize(Me, "PDF", "mm")

If pdf.LoadNotoCJKFont("SC", File.DirAssets) = False Then
    Log("NotoSansSC-Regular.ttf is missing from Files")
    Return
End If

Dim check As Map = pdf.CheckTTFFontCoverage( _
    "NotoSansSC", pdf.fontNormal, "你好,世界!")
If check.Get("Supported") = False Then
    Log("Missing: " & check.Get("MissingCodePoints"))
    Return
End If

Dim p As PDFParagraph = pdf.AddParagraph("你好,世界!")
p.SetFontFamily("NotoSansSC").SetFontSize(15)
pdf.Save(File.DirApp, "chinese.pdf")

LoadBundledNotoSansSC expects the font to be accessible via File.DirAssets. Confirm that the resource is available to the consuming project; otherwise copy it into Files or load from an explicit directory.

Other languages

pdf.LoadNotoCJKFont("TC", File.DirAssets) ' NotoSansTC-Regular.ttf
pdf.LoadNotoCJKFont("JP", File.DirAssets) ' NotoSansJP-Regular.ttf
pdf.LoadNotoCJKFont("KR", File.DirAssets) ' NotoSansKR-Regular.ttf

Do not assume one font covers all CJK scripts: use CheckTTFFontCoverage per text. Use case: multilingual contracts, international statements and reports with searchable Unicode text.