Android Question PDFjetPDF

aboalwaleed

Member
Licensed User
Longtime User
i use PDFjetPDF

and i need Write in Arabic

i see example in this link http://pdfjet.com/java/examples/example-07.html

'##########


publicclassExample_07{

publicExample_07()throwsException{

FileOutputStream fos =newFileOutputStream("Example_07.pdf");

PDF pdf =new PDF(fos,Compliance.PDF_A_1B);

Font f1 =newFont(pdf,newBufferedInputStream(getClass().getResourceAsStream("fonts/DroidFonts/DroidSerif-Regular.otf")),CodePage.UNICODE,Embed.YES);

Font f2 =newFont(pdf,newBufferedInputStream(getClass().getResourceAsStream("fonts/DroidFonts/DroidSerif-Italic.ttf")),CodePage.UNICODE,Embed.YES);

'########################

but i need write by b4a

i write this code but no work

Dim InputFile As InputStream=File.OpenInput(File.DirAssets, "myf.otf")
Dim cp As PDFjetCodePage
Dim PDFFont2 As PDFjetFont
PDFFont2.Initialize4(PDFjetPDF1,InputFile ,cp.UNICODE,True )


can help me please
 

warwound

Expert
Licensed User
Longtime User
The (java class) Font contructor you want to use is wrapped as the b4a PDFjetFont method Initialize4:

Initialize4 (PDFjetPDF As PDF, InputStream1 As InputStream, PDFjetCodePage As Int, Embed As Boolean)

[edit]
Oops i just looked in more detail at your post and see you're already using Initialize4.
What do you mean by 'no work'?
[/edit]
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
Hmmm looks like it works to me!
Look at the attached PDF produced using your code.
I used a kitkat emulator to run your code.
 

Attachments

  • kk1.pdf
    67.2 KB · Views: 395
Upvote 0

warwound

Expert
Licensed User
Longtime User
Hi again.

I just tested your code on a Galaxy Tab 3 (8" running KitKat) and it works perfectly.
The PDF is created and when opened showed some Arabic characters.

What device are you testing your code on?
Do you have access to any other devices?
Can you try and emulator?
 
Upvote 0

cambopad

Active Member
Licensed User
Longtime User
I tested this on the emulator running Android 5 and the app force closed with the following message:
B4X:
java.lang.NoSuchMethodError: No direct method <init>(Lcom/pdfjet/PDF;Ljava/io/InputStream;IZ)V in class Lcom/pdfjet/Font; or its super classes (declaration of 'com.pdfjet.Font' appears in /data/app/b4a.example-1/base.apk)
 
Upvote 0

aboalwaleed

Member
Licensed User
Longtime User
1446878599511.png
 
Upvote 0
Top