B4R Question Simple PDF document creator

Discussion in 'B4R Questions' started by labcold, Oct 8, 2018.

  1. labcold

    labcold Member Licensed 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
  2. Erel

    Erel Administrator Staff Member Licensed User

    I wouldn't use B4R / Arduino / ESP8266 for this. Use Raspberry Pi with B4J instead.
  3. tigrot

    tigrot Well-Known Member Licensed User

    I agree with Erel, a simple micro with no OS is not easy to produce a PDF an eventually print it. A Raspberry with a Linux like OS solves most of the problems.
  4. BillMeyer

    BillMeyer Well-Known Member Licensed 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 ?
  5. labcold

    labcold Member Licensed 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
    BillMeyer and Johan Hormaza like this.
  6. tigrot

    tigrot Well-Known Member Licensed User

    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.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice