B4R Question Simple PDF document creator

labcold

Member
Licensed User
Longtime User
Has anyone done any work on generating a pdf from a B4R device? Its easy from B4A or B4J with the great libraries but I couldnt find anything on B4R.

I need to push some text (mainly) and a simple line graph (or bmp image) to a file that can be accessed from a standard PC using the USB port on my device. The data could be made to fit a single page if necessary. I made a start but ran into many difficulties due to the complex file structure as defined in the PDF standards.

Currently I use a text and csv file set but I would like to have only one visible file on the USB disk which can be readable by a standard pdf reader.

Any help would be gratefully received :D
Thanks
Harry
 

BillMeyer

Well-Known Member
Licensed User
Longtime User
Just a thought.

1. You have a device. (B4A or B4i)
2. You have an Arduino (change to an ESP8266). (B4R)
3. Use an MQTT Server. Connect the ESP and the Device to this MQTT Server. (Mosquitto/B4J Broker)
4. Now connect B4J to this MQTT Server to read all incoming Subscribed MQTT Messages. (B4J)
5. Use B4R on the Arduino to send a JSON via MQTT to the B4J PC/Server (B4R)
6. Create the pdf there with the information in the JSON and then send it to the device via MQTT (you say it's a 1 pager - so size will not really be an issue - IF you limit the size of the Bitmap you use) and you then have a perfect "Cloud4X" Solution.
7. Or go with @Erels solution with a Pi.

@tigrot - your thoughts ?
 
Upvote 0

labcold

Member
Licensed User
Longtime User
Hi All
Many thanks for your input!
it would be nice to move to a larger processor and run android but in this situation its not a viable option. (I have this for B4A for another project anyway using the existing libraries)
BUT I am using ESP32 and unfortunately it has to stand alone.
I have made some progress by making a template and modifying the parts I need.
If I get any success I will post the results in case anyone else needs something like this,

Great Community & Great Tools => May it keep moving ahead :D
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
@tigrot - your thoughts ?
Hi Bill and Labcold.
In my last project I write simple text files on SD. They are log files to make them compliant with Industry 4.0. My food metal detector must log every event. So I simply write a text file with Day/time and reason for event. I remember my old IBM 360/20 when there where no graphic printer around. An header and detail rows and eventually a total for each page. A few memory bytes to handle all this(my memory was 16Kb).
If your need is produce a report use this old tech with no problem.
 
Upvote 0
Top