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,286
Last edited:

mokrokuce

Member
Licensed User
Longtime User
Hello Warwound,
I am evaluating this library and I am trying to print these characters: Š Đ Č Ć Ž, but I get only first and last letter.
I am attaching generated PDF file, look at the second line.
Can you point me in the right direction what to do (I am a newbie)?

Thanks.
 

Attachments

  • pdfjet-test.pdf
    1.1 KB · Views: 171

mokrokuce

Member
Licensed User
Longtime User
Hello Warwound,
I am evaluating this library and I am trying to print these characters: Š Đ Č Ć Ž, but I get only first and last letter.
I am attaching generated PDF file, look at the second line.
Can you point me in the right direction what to do (I am a newbie)?

Thanks.
Forgot to say I am using example from post #10.
 

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
Hi,
I am reading all posts about PDFJet and I am not sure if it is possible adding a second page to PDF.
By the way, I'm not able to do it modifing the example code.
Is it a license problem or anything else?

Thanks
 

Descartex

Well-Known Member
Licensed User
Longtime User
Hi.
You can add more pages with

B4X:
PDFjetPDF1.AddPage(PDFPage1)
PDFjetPDF1.AddPage(PDFPage2)
PDFjetPDF1.AddPage(PDFPage3)
 

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
Hi.
You can add more pages with

B4X:
PDFjetPDF1.AddPage(PDFPage1)
PDFjetPDF1.AddPage(PDFPage2)
PDFjetPDF1.AddPage(PDFPage3)

I'd tried but it doesn't work for me, I got an error with .AddPage method.

I solved the problem this way:

B4X:
  Dim PDFjetConstants1 As PDFjetConstants
   Dim PDFjetPDF1 As PDFjetPDF
   
   Dim PDFDestination As OutputStream
   PDFDestination=File.OpenOutput(File.DirRootExternal, "pdfjet-test.pdf", False)
   
   PDFjetPDF1.Initialize("PDFjetPDF1", PDFDestination)
   PDFjetPDF1.SetAuthor("Foo Bar")
   PDFjetPDF1.SetSubject("A simple pdf document")
   PDFjetPDF1.SetTitle("PDFjetB4A Example")
   
   Dim PDFPage As PDFjetPage
   Dim PDFPage2 As PDFjetPage   
   
   PDFPage.Initialize(PDFjetPDF1, PDFjetConstants1.PageSize.A4_PORTRAIT)
   'PDFjetPDF1.AddPage(PDFPage)

   Dim PDFFont1 As PDFjetFont
   PDFFont1.Initialize(PDFjetPDF1, PDFjetConstants1.CoreFont.TIMES_ROMAN)
   
   Dim PDFTextLine As PDFjetTextLine, PDFTextLine2 As PDFjetTextLine
   PDFTextLine.Initialize(PDFFont1)
   PDFTextLine.SetPosition(10, 10+PDFFont1.GetHeight)
   PDFTextLine.SetText("First line test.")

   PDFTextLine2.Initialize(PDFFont1)
   PDFTextLine2.SetPosition(10, 10+PDFFont1.GetHeight*2)
   PDFTextLine2.SetText("Second line test.")   
   PDFTextLine.DrawOn(PDFPage)   
   PDFTextLine2.DrawOn(PDFPage)       

   PDFPage2.Initialize(PDFjetPDF1, PDFjetConstants1.PageSize.A4_PORTRAIT)   

   PDFTextLine.DrawOn(PDFPage2)
   PDFTextLine2.DrawOn(PDFPage2)   
   
   PDFjetPDF1.Close

As you can see, I only use PDFPage2.Initialize to get the second page.
The order of execution is very important, first initialize and set texts of first page, then initialize and set texts of second page, and so on.

Thanks
 

DonManfred

Expert
Licensed User
Longtime User

Descartex

Well-Known Member
Licensed User
Longtime User
You have to add the pages after filling it.
 

DonManfred

Expert
Licensed User
Longtime User
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:

May i ask you to share the wrapper code with me?

I today bought a PDFJet-License (v5.90) and i would like to adapt the wrapper to this Version.

I can share the new Wrapper-code back if you want. I also can use it for MY use only.
 

Phayao

Active Member
Licensed User
Longtime User
I also like to thank for this phantastic library !
Nevertheless I suddenly got a problem which came without changing anything in my pdf output part of my program:
java.lang.Exception: Sub pdfjetpdf1_closecomplete was not found.

Though the sub PDFjetPDF1_closecomplete(Success as boolean) has been there all the time.
The error occurs after PDFjetPDF1.Close in my CreatePDFTable sub.

The whole code to post would be very lengthy - but now I'm desperate and wondering if anybody else encountered this problem.

Has anything changed in the library ? I'm using the 1.10 version from post #1.

Any help is very much appreciated,

Chris


PS: I found the error: the Sub PDFjetPDF1_closecomplete HAS TO BE in the main activity because the program goes through Activity_Resume.
I cannot understand how it worked before, but now it's obviously like that.
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hi Warwound how are you.
A question, can you share your wrapper PDFJet sources with me ?
Thank you in advance and have a nice day
Marco
 

DonManfred

Expert
Licensed User
Longtime User
How could I upload data from a database and display it in a PDF file?
Read the Data from your Database and use the Methods of the Lib to create a PDF (or even more than one) out of them.
There is no ready/buildIn method to do this inside the lib; must be done by yourself.
 

abosalaheldin

New Member
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.
Is it possible to get the output which is sent to bluetooth thermal printer and print it to pdf file instead. If it is possible please give answer in detail becaue I'm beginner in b4a programming. Thank you.
 

DonManfred

Expert
Licensed User
Longtime User
Top