B4J Question B4J Server advise

moster67

Expert
Licensed User
Longtime User
We have a folder in our network with pdf-files generated from original paper documents scanned with a Code_128 bar-code (attached manually before scanning).
With the help of a small B4J console app that I wrote (PDFBarcodeReader), this app gets the image from a scanned pdf-file and then gets the value of the bar-code. The pdf-file is thereafter moved to another directory ("Processed files) and renamed from the original file-name generated by the scanner to a format such as "barcode-value.pdf".
Then we use a B4J-server implemented as a file-server to "serve" these pdf-files to users (the pdf-files are opened in a web-browser)

Currently the B4j console app is running on its own as a separate program (scheduled to run at certain intervals) and also the fileserver is running as a separate program. This solution works fine.

However, I was thinking that it might be nice to integrate the B4J console app into our B4J-server (File-server). This would mean that the B4J-server at certain times would be serving documents but also processing PDFs to get bar-codes. Would this be feasible or do you think this would slow down matters and might create problems? If it is possible, anything in particular I should think about when implementing the B4J console app into the server? Any tips?

BTW: I will post sometime in the future the B4J and Java sources of my PDFBarcodeReader which is written in B4J and using PDFBox and XZING as support libraries. I found solutions which do the same but they are very expensive. Much easier to implement it with B4X and you can customize according to your needs 100%. All this thanks to B4X!
 

moster67

Expert
Licensed User
Longtime User
Not sure if it the task is heavy or not.
It takes about 1-1.5 seconds to process each document. 100 documents is about 1.5 - 2.0 minutes. This includes everything; extracting image from pdf, obtaining barcode, copying files etc...
OK, I think I will try with a background worker and see how it goes.
 
Last edited:
Upvote 0

Harris

Expert
Licensed User
Longtime User
PDFBarcodeReader which is written in B4J and using PDFBox and XZING
I would sure like to see this.
Using jNextReports, I create a complex report.pdf which is stored in a directory.
Then I use @alwaysbusy ABMPDFBox (wrapper) to print pdf files - as that's all it currently supports (which is just fine for now).
Once the report is printed after each work shift, the pdf file is deleted.

Would be nice if we could wrap this for B4A and create complex PDF's on the device (as I do now with very old wrappers).

PDFBox seems very powerful to do much more, so it would be nice to see what you do with it (code).

Can anyone provide an example of what you CAN'T do with B4X? (and making your breakfast doesn't count)...

Thanks
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
I simply implemented the PDFRender-object from PDFBox which lets me extract an image from a pdf-file. You can use PDFBox to generate pdf-files as well although I did not try (or implement) it in my wrapper.
If you send me a PM I can send you the wrapper-code in Java and you can use it as a template to add your own functionality.
I think you can do it with JavaObject as well by adding the PDFBox as an additionalJar in your B4J-project.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Oops, I saw only now that you mentioned B4A...well didn't try it and I cannot see on the homepage if it supports Android or not. I believe PDFBox uses java awt and swing, even for non UI tasks and this might make it difficult.

However, I saw this:
https://github.com/TomRoush/PdfBox-Android
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
upload_2018-1-14_4-21-39.jpeg



:D
 
Upvote 0
Top