B4J Library jJasperReports Library

Hi. I want to share this jJasperReports library with the community.
It needs several libraries to work. I provided a link: download
---More libraries needed (missing from the first link): download
You also need to download databases jdbc drivers: sql jdts, mysql and oracle
New Link (All jar files are included in this link): Download
All jars need to be placed in Additional Libraries folder.
In the B4J project you need to add a jar file: #AdditionalJar: itext-2.1.7.js1
Library files and a small example is provided.
Please feel free to test the library.
Note: for some reason when using SubReports, the compiled (.jasper) files need to be in the same level as the app jar file. XML Reports (.jrxml) can be in any other folder different from the app jar file. (e.g. if report.jrxml is in File.DirApp & "/reports" then all compiled (.jasper) subreports need to be in File.DirApp. In the example provided .jrxml and .jasper are in the same level as jaspertest.jar.

v1.00 - Release
v1.10 - SQLite support added. MySQL useSSL variable added.
v1.12 - Changed the way the JasperViewer works. Now you can set the form to full screen, use the default size and location or set a specific size and location.
v1.13 - Added method PrintDirectlyToPrinter.
v1.20 - Access support added via uCanAccess jdbc driver. Note: When creating reports in Jaspersoft Studio you need to add all jar files that ucanaccess needs. The metadata won't work but you can create a query and it will work.
v1.22 - Added functions to export report to XLS and XLSX. Note: need 2 more jar files: download. Copy them into Additional Libraries folder.
v1.24 - Added function Print3 to be able to show reports without a Data Source.

------------------------------------------

NEW VERSION 2.00
Special thanks to Num3 for testing this library and helping me getting it done.

Instructions:
1. Libraries needed: Donwload
2. Place all jars in Additional Libraries folder
3. Specify in B4J project with #AdditionalJar: the database that is going to be used. (e.g. #AdditionalJar: mysql-connector-java-5.1.49-bin)
a. If using ucanaccess-5.1.0 database please add these in addition to #AdditionalJar: ucanaccess-5.0.1:
- #AdditionalJar: commons-lang3-3.8.1
- #AdditionalJar: commons-logging-1.2
- #AdditionalJar: hsqldb-2.5.0
- #AdditionalJar: jackcess-3.0.1

v2.00 - Same functionality as v1.24 but based on jasperreports-6.17.0. Previous v1.24 was based on jasperreports-6.7.1.
 

Attachments

  • mainform.png
    mainform.png
    8.1 KB · Views: 1,777
  • jrxml_exported_to_pdf.png
    jrxml_exported_to_pdf.png
    53.9 KB · Views: 1,751
  • jrxml_subreports.png
    jrxml_subreports.png
    53.6 KB · Views: 1,829
  • jrxml_single_report.png
    jrxml_single_report.png
    16.7 KB · Views: 1,779
  • jJasperReports.zip
    10.2 KB · Views: 1,065
  • sqlite_report.png
    sqlite_report.png
    35.1 KB · Views: 1,594
  • jaspertest.zip
    2.8 KB · Views: 1,086
  • jJasperReports - 1.24.zip
    17.4 KB · Views: 767
  • jJasperReports - 2.00.zip
    17.6 KB · Views: 615
Last edited:

Situ LLC

Active Member
Licensed User
Thanks to share
Caused by: java.io.FileNotFoundException: C:\PREC72~1\JASPER~1\Objects\RepName.jrxml ( The system cannot find the specified file)
I was able to runt the test , I couldn't create these mentioned files missing, something else is missing , there are more examples and literature ?
Thanks
 

Juan Marrero

Active Member
Licensed User
Longtime User
Thanks to share
Caused by: java.io.FileNotFoundException: C:\PREC72~1\JASPER~1\Objects\RepName.jrxml ( The system cannot find the specified file)
I was able to runt the test , I couldn't create these mentioned files missing, something else is missing , there are more examples and literature ?
Thanks
You have to create the reports (.jrxml) with tools like Tibco Jaspersoft Studio. I use Tibco Jaspersoft Studio Community Edition.
 

Situ LLC

Active Member
Licensed User
Thnks
 

Juan Marrero

Active Member
Licensed User
Longtime User
hi
problem with arabic characters in export pdf
solved??
I looked into old private messages and at least I solved it using DejaVu font. I first tried with Arial but didn't worked. Only worked with DejaVu. It's included in versions newer than 1.20.
 

behnam_tr

Active Member
Licensed User
Longtime User
I looked into old private messages and at least I solved it using DejaVu font. I first tried with Arial but didn't worked. Only worked with DejaVu. It's included in versions newer than 1.20.

thanks i test DejaVu font and is ok in pdfexport
but i want to use other fonts,any other truetype fonts

sample and font attached
 

Attachments

  • testJasper.zip
    125.1 KB · Views: 350

Juan Marrero

Active Member
Licensed User
Longtime User
thanks i test DejaVu font and is ok in pdfexport
but i want to use other fonts,any other truetype fonts

sample and font attached
In theory any fonts that support Arabic symbols (characters) should work. Since I live in Puerto Rico (US Territory) I don't know any fonts (outside DejaVu) that support Arabic characters (or any other language that is not Spanish or English). I will download your testJasper.zip file and I will try to look into it.
 

Juan Marrero

Active Member
Licensed User
Longtime User
On a quick review, DejaVu fonts are inside jasperreports-fonts-6.0.0.jar. So I'm guessing if it's possible to include your font into a jar, I could add it to the library.
 

behnam_tr

Active Member
Licensed User
Longtime User
On a quick review, DejaVu fonts are inside jasperreports-fonts-6.0.0.jar. So I'm guessing if it's possible to include your font into a jar, I could add it to the library.

thanks for help....
i could add other font that support persian or arabic characters
and Now pdfExport Is Ok for B Titr Font .that is a trueType Font
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For addind Your TrueType Fonts

1..open jasperreports-fonts-6.0.0.jar Wiht 7-zip software

2.add your fonts to >> net/sf/jasperreports/fonts

3.open fonts.xml with notepad and add this codes
B4X:
<fontFamily name="B Titr">
        <normal>net/sf/jasperreports/fonts/myfonts/BTitr.ttf</normal>
        <bold>net/sf/jasperreports/fonts/myfonts/BTitr.ttf</bold>
        <italic>net/sf/jasperreports/fonts/myfonts/BTitr.ttf</italic>
        <boldItalic>net/sf/jasperreports/fonts/myfonts/BTitr.ttf</boldItalic>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
        <exportFonts>
            <export key="net.sf.jasperreports.html">'B Titr', Arial, Helvetica, sans-serif</export>
            <export key="net.sf.jasperreports.xhtml">'B Titr', Arial, Helvetica, sans-serif</export>
        </exportFonts>
        
    </fontFamily>

4.Open and edit "jasperreports_extension.properties" file and add this line code
B4X:
net.sf.jasperreports.extension.simple.font.families.myfonts=net/sf/jasperreports/fonts/fonts.xml

5.in iReport software set label font property like attached image (I'm Using iReport 5.2.0)

6.Done.
 

Attachments

  • help pdffont set.png
    help pdffont set.png
    218.7 KB · Views: 319

focus330

Member
Licensed User
Longtime User
HI
I created some reports with TIBCO. One of them has a picture ( a png image ). Exporting this report as Report Template the app exports also the image.
Calling GasperViewer from b4j i have this error :
net.sf.jasperreports.engine.JRException: Byte data not found at: flower1.png.
What means ? What is wrong ?
Thanks
 

Juan Marrero

Active Member
Licensed User
Longtime User
HI
I created some reports with TIBCO. One of them has a picture ( a png image ). Exporting this report as Report Template the app exports also the image.
Calling GasperViewer from b4j i have this error :
net.sf.jasperreports.engine.JRException: Byte data not found at: flower1.png.
What means ? What is wrong ?
Thanks
Did you put flower1.png at the same level as your report?
 

Situ LLC

Active Member
Licensed User
I have the same ..
 

Juan Marrero

Active Member
Licensed User
Longtime User
I have the same ..
I don't recall if the example provided have the SQLite Button. In that button's code there is an example of how to include pictures in the report. In early versions of the library you had to put it at the same level as the report but now you can specify where the picture is (I totally forgot about that).
B4X:
    Dim jasper As JasperReports
    Dim report As JasperReport
    Dim print As JasperPrint
    Dim conn As JasperConnection
   
    jasper.InitializeParameters
    report = jasper.CompileXML(File.Combine(File.DirApp, "sqlite_test.jrxml"))
    jasper.AddParameter("realPath", File.Combine(File.DirApp, "cherry.jpg"))
    conn = jasper.getConnectionSQLite(File.Combine(File.DirApp, "jasperTest.db"))
    print = jasper.Print(report, jasper.parameters, conn)
    jasper.JasperViewer(print, True)
1617884618285.png

I created a Parameter called realPath as String.
1617884763294.png

In the image properties (under Image Tab) in Expression I selected the parameter "realpath". Please click on the "Form+Pencil" button to enter Expression Editor to select the Parameter.
 

Situ LLC

Active Member
Licensed User
Thanks
 

Xfood

Expert
Licensed User
Hi. I want to share this jJasperReports library with the community.
It needs several libraries to work. I provided a link: download
---More libraries needed (missing from the first link): download
v1.22 - Added functions to export report to XLS and XLSX. Note: need 2 more jar files: download. Copy them into Additional Libraries folder.
v1.24 - Added function Print3 to be able to show reports without a Data Source.
Good morning,
sorry, these links to download the additional libraries are no longer active, I can't download the libraries,
could someone make available a zip file with all the necessary libraries?
Thanks a lot to everyone
 

Juan Marrero

Active Member
Licensed User
Longtime User
Good morning,
sorry, these links to download the additional libraries are no longer active, I can't download the libraries,
could someone make available a zip file with all the necessary libraries?
Thanks a lot to everyone
You sure? They worked for me.
 
Top