B4J Question how set UNICODE in jPDFjet library

behnam_tr

Active Member
Licensed User
Longtime User
hi

i want to use jPDFjet library
https://www.b4x.com/android/forum/threads/jpdfjet.37842/

everything is ok but i have a problem with persian and arabic characters
this chars dont show in pdf file after creat pdf

anyone can help me ?

i use this code but im getting error
B4X:
Dim PDFFont1 As PDFjetFont
    Dim Cp As PDFjetCodePage
    Dim InputStream1 As InputStream
    InputStream1 = File.OpenInput(File.DirAssets,"iran_sans.ttf")

PDFFont1.Initialize4(PDFjetPDF1,InputStream1,PDFjetConstants1.CodePage.UNICODE,False)
    InputStream1.Close



B4X:
main._createpdftable (java line: 180)
java.lang.NoSuchMethodError: com.pdfjet.Font.<init>(Lcom/pdfjet/PDF;Ljava/io/InputStream;IZ)V
    at uk.co.martinpearman.b4j.pdfjet.FontWrapper.Initialize4(FontWrapper.java:83)
    at b4j.example.main._createpdftable(main.java:180)
    at b4j.example.main._button1_click(main.java:120)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
    at java.lang.Thread.run(Thread.java:748)
 
Last edited:

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User

this library is no longer mantained and it is not on sync with latest JPdfJet releases. i recommend this one:

https://www.b4x.com/android/forum/threads/pdfjet-rewrapped.89973/

i do not give manteinence also but you have access to the source code that is written in B4x JavaObject.

then to craete a Font with unicode support you only need to do this:

B4X:
   Dim ins As InputStream = File.OpenInput(File.DirAssets,"timesbd.ttf")

   Dim font2 As jetFont
   font2.Initialize
   font2.Initialize2(pdf,ins,"UNICODE")
 
Upvote 0
Top