Report preparation on MIT need ideas please

I have designed text based reporting, i have a print format table config and matching SQLite table query, I am able to print various reports… This was first step for me just to bring out data in basic text format… Now, I would like to bring it on PDF reporting format… When I used an extension of save as PDF…


Here is my original text report printed out of my MIT app for one of a simple report, Report.2020_03_06_04_12_43.txt (499 Bytes) when same text is passed onto the saveAsPdf converter to get following pdf file,default.pdf (19.3 KB) My concerns are, 1. The Line feed has not come into PDF, all text are printed continoulsy in one line… I don’t know why… Anyways, I wanted to ask experts, is the report generation process is correct this way, or any other better solutons are available… I’m ready to rewrite my code, as the skelton is ready, I can change the text implement to other plaforms easily… Please give your suggestions… Thanks a lot…

Hello Prabu

To help you, we need to see your code Blocks. The Line Feed sounds strange - what are you using for end-of-line for your text file? Should be the same for PDF.

Hello @ChrisWard

Please see my code of printing text records in AppendToFile method with \n => new line and \r ==> line feed… If you see my output report text file is having line breaks… In pdf it is missing… After printing onto text file, I read from the file, and within the GotText event I call saveAsPDF method… blocks (15)

Please answer for above concern, at the same time I would like to ask, is there better way of formatting through different means like using extension for Microsoft Excel or something like cystal report (instead of writing as a text file records)… Thank you…

Right - for PDF and the text, \n alone should work. Probably the easiest way to present the report would be as an HTML page. Especially if some of the information lends itself to being tabulated. However I think you are outputting to PDF so that the reports can be read by practically any device? The good news there is that Developer Leo has an extension to convert HTML to PDF:
https://puravidaapps.com/extensions.php

HTML is extremely easy to learn:
https://www.w3schools.com/html/default.asp

… and you can build an HTML page in App Inventor (you can save it as a file just as you do now with text files).

1 Like

Thank you @ChrisWard I’m working on HTML formating of my report… Can we view HTML on android - offline? I will give Text and HTML formats… On screen mode, 1. For Text mode- I can just print the same on to a text box, 2. For HTML mode - I would like to bring offline web view… If printed on HTML, we can provide to explore and save as PDF option for a printable pdf version… Please suggest if my approach is right…

blocks (15) I’m using LeoSaveAsPDF extension, when we use syle sheet files, for generating tabular format on HTML output, where those files to be kept?

Healer template.html.txt (8.6 KB) I put those files (bootstrap.min.css and grid.css) under asset folder, but formating was not picked up…For information within HTML the css files refered with path “./bootstrap.min.css” and “./grid.css”… Any idea please … Thanks

This:
<link href="./grid.css" rel="stylesheet">
Should be this:
<link href="grid.css" rel="stylesheet">

Maybe you have other problems like this, but the the above should help, provided that you have grid.css in yous assets.

Cheers, Ghica.

Ghica, Thanks for your help on this, as you suggested, I have both the css files in the MIT project assets…Here with I have attached both the css file with .txt format as CSS files were not allowed to attach… I don’t know you have LeoSaveAsPDF extension… I’m not getting any help or response from the developer of this extension to understand the difficulties to get a solution to this problem… bootstrap.min.css.txt (141.5 KB) grid.css.txt (372 Bytes)

Hi Prabu_joyous,
I do not know why my append looks strange. So let me say this again. (see my updated append too)
Probably there is nothing wrong with your css, but you must update your html file to say bootstrap.min.css instead of ./bootstrap.min.css and likewise for the other css file. This is because both the html and the css files are in the same directory in the assets.
Cheers, Ghica.

Hi,

I need more explanation. What is it that you are trying to do?

If I press a button, I am supposed to choose an html file, but I do not have any. Where in your scenario are the html files to be found?
And, what do you want to do with the generated pdf’s?
Cheers, Ghica

sorry, I din’t give my sample html file, I just want to know that if this extension can print styles of external css files, That’s all… If you download to all these files to desktop and view the HTML on web browser, will display in tabular report format… But If I print through this extension, it doesn’t take the exernal CSS, In case if it can’t use external css files then I have to do the internal style sheet method… Thanks… bootstrap.min.css.txt (141.5 KB) grid.css.txt (372 Bytes) Healer template.html.txt (8.6 KB)

A couple of ideas:

Make sure all your files are in the same directory

Try with putting your css files online somewhere and calling the url

Thanks Tim for ideas… I’m OK for web url call for this to save as pdf… Anybody knows any web call on which we can convert HTML to PDF… I am ready to write code to wrap in HTML for reporting, once I know the right way of doing, then will program it.I’m new to these areas… Thanks again…

For the third time, you have to adapt your healer template.html, which you have in your assets,
to say this:

link href=“bootstrap.min.css” rel=“stylesheet”
link href=“grid.css” rel=“stylesheet”

instead of this:
link href="./bootstrap.min.css" rel=“stylesheet”
ink href="./grid.css" rel=“stylesheet”

sorry about the disappearing text, you cannot write < or > apparently.
Cheers, Ghica.

And of course grid.css and bootstrap.min.css should be uploaded in your assets too.
Did you look at these:
https://puravidaapps.com/snippets.php#2htmlread
and the tools extension PathToAssets: https://puravidaapps.com/tools.php
Cheers, Ghica.

1 Like

@Ghica you can, but you have to use preformatted text
<link href="./grid.css" rel="stylesheet">

preformated text

Taifun