B4A Library PDFjetB4A

PDFjetB4A is a PDF document authoring library for B4A

PDFjetB4A wraps the PDFjet for Java library from pdfjet.com.
Here are some of it's features:

Drawing support for:
  • Points
  • Lines
  • Boxes
  • Circles
  • Bezier Curves
  • Polygons
  • Stars
  • Complex paths and shapes

Text
  • Unicode support
  • Text kerning when using the Helvetica and Times-Roman families of core fonts
  • Embedding hyperlinks
  • Support for embedding OpenType and TrueType fonts
  • Support for the fonts included with Reader 7.0 and Reader 8.0 installations

Embedding of the following types of images:
  • PNG
  • JPEG
  • BMP

High level components:
  • Simple to use Table class with flexible reporting capabilities
  • Flexible Chart component with support for scatter plots and lines
  • TextColumn component with text kerning and justification support
  • Support for Code 39 and Code 128 barcodes
  • Support for PDF417 and QR code 2D barcodes

PDFjet for Java is available under both free evaluation and paid for licenses.
PDFjetB4A can be used with both the free evaluation and paid for licenses.
The free license version used to be feature limited, it looks as though the latest free license version contains all the features of the paid for license but i have not checked that.
PDFjetB4A wraps all available features of the paid for license version - if any of those features are not available in the free license version then the features will show in the B4A IDE but not be available for use.
Trying to use a feature that is not available is like to raise a ClassNotFound exception.


In order to use PDFjetB4A you will need to:
When downloading either version you will agree to and accept the license terms and conditions that apply to the version you download.

EDIT: Please read post #2 to find out about all available versions of PDFjet for Java.

Your PDFjet for Java download will contain the java library file PDFjet.jar.
Copy PDFjet.jar to your B4A additional libraries folder.

Now download the attached PDFjetB4A library files and copy these to your B4A additional library folder.
Your B4A additional libraries folder should now contain: PDFjetB4A.jar, PDFjetB4A.xml and PDFjet.jar.
PDFjetB4A.html is for reference only - you don't need to copy this file to your additional libraries folder.
If you upgrade from the free version to the paid for version you just need to overwrite the free version of PDFjet.jar with your paid for version of PDFjet.jar.

One thing i have not done is to add a lot of the javadoc reference to the B4A library.
Many methods are self-explanatory, some are obscure and some lack any javadoc reference.
In your download from pdfjet.com there is a folder docs/java which contains the PDFjet for Java javadoc reference.
Open docs/java/index.html in your browser to see all the available reference/documentation.

I have also created a B4J version of this library, see the jPDFjet thread.
Both B4A and B4J versions share the same syntax.

There are some java examples of usage of PDFjet both online and in the download from pdfjet.com.
I have converted some of these java examples to a B4J project and this B4J project is available in the jPDFjet thread.
(I've not had time to create a B4A demo project).

Library files attached.

Martin.
 

Attachments

  • PDFjetB4A-library-files-v1.10.zip
    78.8 KB · Views: 1,653
Last edited:

warwound

Expert
Licensed User
Longtime User
PDFjet is a PDF creator library so you can create PDFs.
That applies to both open source and paid for versions.

Modifying existing PDFs is supported only in the commercial version.

Martin.
 

flandersdl

Member
Licensed User
Longtime User
I just found your library today and can only download version 5.07. Only a couple of the examples still work in either b4a or b4j. So it seems that the new version had broken your wrapper.
I am going to download you compiled open source to continue testing.
 

warwound

Expert
Licensed User
Longtime User
@flandersdl

Thanks for reporting that the latest version of PDFjet does not work with the b4a and b4j libraries.
I've made a note to look at an update but can't promise anything soon, i'm rather busy with other things for a while.
 

flandersdl

Member
Licensed User
Longtime User
No worries for me. I am still in the early stages of the program. Whenever you get to it will work for me.
 

johndb

Active Member
Licensed User
Longtime User
Is there any update as to when the library will be updated for the new PDFjet version?
Not to sound pushy or anything :) Just curious ;)

Thanks,

John
 

Peter Simpson

Expert
Licensed User
Longtime User
This is excellent @warwound. This library works perfect with no issues whatsoever, and it's really easy to use :)
 

warwound

Expert
Licensed User
Longtime User
Is there any update as to when the library will be updated for the new PDFjet version?
Not to sound pushy or anything :) Just curious ;)

Thanks,

John

I'll be too busy with work for the rest of this month to look at an update - i've made a note on my calendar to look at it in Feb.
 

peacemaker

Expert
Licensed User
Longtime User
FAQ says:
  • Cyrillic and Greek do not require embedded fonts.
But sample is http://pdfjet.com/java/examples/example-06.html and shows that font is to be embedded.
And free version does not have Font.Initialize4 method...
Good lib :), but useless, for national letters :-(.
 

peacemaker

Expert
Licensed User
Longtime User
Martin,
Does free version contain the method ?
B4X:
PDFjetPDF1.AddPage
Or only in paid version ?

After adding a new page i always get java.lang.NullPointerException...
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Greetings.

I am testing the library modifying the sample app provided by Martin. I am trying to just print 10 lines. This is the code:

B4X:
Dim PDFPage As PDFjetPage
    PDFPage.Initialize(PDFjetPDF1, PDFjetConstants1.PageSize.Letter_LANDSCAPE) '.A4_PORTRAIT)
   
    Dim PDFFont1 As PDFjetFont
    PDFFont1.Initialize(PDFjetPDF1, PDFjetConstants1.CoreFont.TIMES_ROMAN)
   
   For i = 1 To 10
        PDFPage.PrintLn2("This is thePDFjetTextLine object, it should be rendered at point (10, 10) on the PDF page. i = " & i )
    Next

I get a blank page. What is wrong with the code?

Any and all help is welcomed.

Thank you.

Sandy
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Greetings.

This code works, but why not just the PrintLn2?

B4X:
    Dim PDFPage As PDFjetPage
    PDFPage.Initialize(PDFjetPDF1, PDFjetConstants1.PageSize.Letter_LANDSCAPE) '.A4_PORTRAIT)
   
    Dim PDFFont1 As PDFjetFont
    PDFFont1.Initialize(PDFjetPDF1, PDFjetConstants1.CoreFont.TIMES_ROMAN)
   
    Dim PDFTextLine As PDFjetTextLine
    PDFTextLine.Initialize(PDFFont1)
    'PDFTextLine.SetPosition(10, 10+PDFFont1.GetHeight)
    For i = 1 To 10
        PDFTextLine.SetPosition(10, i*(10+PDFFont1.GetHeight))
        PDFTextLine.SetText("This is the PDFjetTextLine object, it should be rendered at point x=10, y= " & (i*(10+PDFFont1.GetHeight)))
        PDFTextLine.DrawOn(PDFPage)
        'PDFPage.PrintLn
        'PDFPage.Print("test print " & i)
        'PDFPage.PrintLn
    Next

Any help is welcome.

Sandy
 

peacemaker

Expert
Licensed User
Longtime User
RU text i have to print by bitmap-lines :-( no UTF-8 font to be embedded :-(
 

peacemaker

Expert
Licensed User
Longtime User
Non-latin symbols for PDF require a Unicode font to be embedded into the PDF file.
This lib allows only 3 or 4 asian Unicode fonts without embedding, but they look terrible.
So, i print text on Bitmap by a canvas and assemble PDF from such Bitmap lines :-(
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Thank you, peacemaker.

Yours is truly a universal solution. Good to know for potential development in the future. My target market, international, will only include Latin symbols in 4 languages initially...

I am new to this pdfview wonderful library (thank you, Martin). My question remains why the PrintLn2 or the Print does not work in my post above? I get a blank page.

Best regards.

Sandy
 
Top