B4J Library PdfJet Rewrapped

Hi!

I do like a lot this library and a lot of people uses it, but the awesome library wrapped by @warwound it is a bit outdated. so i decided to wrap mine, but i have never been able to compile a single line of java so this wrap was made in its entirety with JavaObject,

I uploaded the B4J Project as i do not know if i can maintain it, and for this first version it is just 3 classes with a single drawString method. Why? well... it is more of a tutorial than a full wrapped library, i think its to easy to see how it was made, so i hope someone finds it useful.

To work on it i recommend to download the evaluation version of pdfJet here:
http://pdfjet.com/java/download.html

In the zipped file you will find pdfJet.jar Version 5.9, copy to your additional jar folder and it should work without further issues.

In the same zipped file you will find a docs folder, here comes the JavaDocs, those are very good to work with javaobject

If you need to add any functionality and do not know how, just ask, i will try to find sometime to help!

EDIT 04/05/2018
new version with Table class

EDIT 22/08/2018
new initializations for font

EDIT 27/08/2018
new drawRect in page,
 

Attachments

  • pdfJetLibrary.zip
    195.6 KB · Views: 1,071
Last edited:

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Why this error hapens?

B4X:
jetfont._initialize2 (java line: 71)
    java.lang.RuntimeException: Constructor not found.
    at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:95)
    at b4j.example.jetfont._initialize2(jetfont.java:71)
    at b4j.example.main._appstart(main.java:94)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:37)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
    at java.lang.Thread.run(Thread.java:748)

please make your questions in the B4J questions forum. people will be more willing to help you there. also, you need to give us some code in Debug mode to help you better.
 

cliv

Member
Licensed User
Longtime User
I try to use trial version 7.0 (to evaluate), not open source and i have this error:

Error::
Waiting for debugger to connect...
Program started.
Error occurred on line: 19 (jetFont)
java.lang.ClassNotFoundException: com$pdfjet$CodePage
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:274)
    at anywheresoftware.b4j.object.JavaObject.InitializeStatic(JavaObject.java:75)
    at b4j.example.jetfont._initialize2(jetfont.java:83)
    at b4j.example.main._appstart(main.java:130)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:187)
    at java.lang.Thread.run(Thread.java:748)

Version 7.00 - Released on 7th of August / 2020.
Major refactoring of the code.
Improved all the text classes, the table and the chart modules.
Many performance improvements.

Last working version with this library is 6.05.
 

Attachments

  • PDFjet 7.0 _Trial.zip
    235.9 KB · Views: 387
Last edited:

BigBoss123

Member
Licensed User
Longtime User
I try to use trial version 7.0 (to evaluate), not open source and i have this error:

Error::
Waiting for debugger to connect...
Program started.
Error occurred on line: 19 (jetFont)
java.lang.ClassNotFoundException: com$pdfjet$CodePage
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:274)
    at anywheresoftware.b4j.object.JavaObject.InitializeStatic(JavaObject.java:75)
    at b4j.example.jetfont._initialize2(jetfont.java:83)
    at b4j.example.main._appstart(main.java:130)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:187)
    at java.lang.Thread.run(Thread.java:748)



Last working version with this library is 6.05.
I'm having the same error message.
Do you have a open source version of PDFjet. version 6.05?

I would be most appreciate your help to get this PDF to work.

Thanks

David
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Hi! no there aren't but if you need any specific functionality you could ask for it. i can't guarantee it can be done tho.
 

giannimaione

Well-Known Member
Licensed User
Longtime User
thanks for your fast reply, but there is same error:
B4X:
java.lang.NoSuchMethodError: com.pdfjet.TextLine.setText(Ljava/lang/String;)
at uk.co.martinpearman.b4j.pdfjet.TextLineWrapper.SetText(TextLineWrapper.java:114)
B4J 9.50 64bit
jPDFjet 1.10
and download the evaluation version of pdfJet
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
uk.co.martinpearman.b4j.pdfjet.TextLineWrapper.SetText
You are using the library of WarWound that library is no longer mantained and its separated of this project. Sorry for the confusion but its not something i can help you with
 

giannimaione

Well-Known Member
Licensed User
Longtime User
thanks for all,
i will try with pdfbox
 

Bernard Berger

Member
Licensed User
Hi,
First of all, a big thank you for your library. It's brilliant and works like a charm.

I do have a small issue though ..

A PDFjetImage.Initialize doesn't seem to load a PDF image, even when using PDFjetConstants1. ImageType.PDF.

Dim Image1 As PDFjetImage
Image1.Initialize(MyPDF, File.OpenInput("MyFileDir", "MyImageVectorized.pdf"), PDFjetConstants1.ImageType.PDF)

My undesrtanding/hope was that I could used a vectorized image saved as PDF and load it in a PDFJetImage object.


Thank you in advance for your answer,
Regards,
Bernard
 

Attachments

  • Vector.pdf
    2.7 KB · Views: 252
Top