B4J Question Unicode Text not showing in a PDF created with jPDFjet Library

khaleel

Member
Licensed User
Longtime User
When I create a pdf file using jPDFjet Library , Unicode (Arabic) text is not showing when I open the output file using Adobe reader.Any one knows what should I do enable it to show?
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
According to PDFjet webPage in order to do that you must

Declare the font

(JAVA)
B4X:
BufferedInputStream bis2 =newBufferedInputStream( getClass().getResourceAsStream("fonts/DroidFonts/DroidSerif-Regular.otf"));
Font f2 =newFont(pdf, bis2,CodePage.UNICODE,Embed.YES);

SO.... you should use something like this:

B4X:
private Sub test
Dim InputS As InputStream = File.OpenInput("path","FileName") ' of your arabic font
Dim pd As PDFjetPDF
pd.Initialize("test","FileTest") ' of your PDF

Dim pdCode As PDFjetCodePage ' This is an ENUM so no initialize needed

Dim F As PDFjetFont
F.Initialize4(pd,InputS,pdCode.UNICODE,True) 'Relevant Code
End Sub
 
Upvote 0

khaleel

Member
Licensed User
Longtime User
Okay,thank your response.
but when I call this function :
PDFFont1.Initialize4(PDFjetPDF1,InputS ,pdCode.UNICODE,True )
I get this Error:
java.lang.NoSuchMethodError: com.pdfjet.Font.<init>(Lcom/pdfjet/PDF;Ljava/io/InputStream;IZ)V

any idea ?
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Which PDF Jet version are you using?? did you downloaded the Open Source version from their web page? their evaluation version may be? WarWound wrapper is 2 or 3 versions behind, that means that it will not work with newer versions of pdfjet.

I suggest you download his compiled PDFJET open source jar. that you can find in the second post:
https://www.b4x.com/android/forum/threads/jpdfjet.37842/

Look for this line:
  • Download my ready compiled Open Source Edition PDFJet.jar

If you want to have the paid version or the evaluation version up to date, i am afraid that you will need to create your own wrapper or do it with InLine java.
 
Upvote 0
Top