Printing reports
Posted: Sun Jul 01, 2018 11:52 am
I am writing a program which generates some reports that must have the possibility to be printed on a (air)printer.
Currently i found a method, but it is a very clumsy one. Perhaps some of you have better ideas, but first i will point out my clumsy method.
1. In the (SB) program, the output font is set to a fixed pitch font, i used 'Courier'.
2. Each line is first built up in a string, using formatting functions for text and numbers.
3. The line is the printed on screen, and, depending on a switch, also to an ascii printfile. So far, so good (see picture 1.)
4. The printfile is then ported from the SB sandbox to an app that can print to a printer, using copy/paste. I tried "Notes" and "Pages". In both cases the font information is lost and the report becomes a mess (see picture 2)
5. Only in "Pages", the "Courier' font can be defined again and the report looks good again and may be printed using airprint. (See picture 3.)
My question is whether there is a more simple, direct method.
A SB file command, sending a file to a printer would be the best option, but may not be expected any soon.
Is it possible to write a function using the browser facilities in SB?
After all, an (air)printer has its own local(?) IP adress, and a browser must be able to send text to an URL?
I have very little experience using browser and other internet stuff, hence i put the question here.
If it can be done, i will write some functions to print multi-page reports in a proper way. I used them in the good old DOS period, using Borland's turbo-C.
Picture one, report on screen (and when viewing the printfile).
Picture two, printfile arriving at "Notes" or "Pages"
Picture three, printed by "Pages" after selecting "Courier" font again.
Currently i found a method, but it is a very clumsy one. Perhaps some of you have better ideas, but first i will point out my clumsy method.
1. In the (SB) program, the output font is set to a fixed pitch font, i used 'Courier'.
2. Each line is first built up in a string, using formatting functions for text and numbers.
3. The line is the printed on screen, and, depending on a switch, also to an ascii printfile. So far, so good (see picture 1.)
4. The printfile is then ported from the SB sandbox to an app that can print to a printer, using copy/paste. I tried "Notes" and "Pages". In both cases the font information is lost and the report becomes a mess (see picture 2)
5. Only in "Pages", the "Courier' font can be defined again and the report looks good again and may be printed using airprint. (See picture 3.)
My question is whether there is a more simple, direct method.
A SB file command, sending a file to a printer would be the best option, but may not be expected any soon.
Is it possible to write a function using the browser facilities in SB?
After all, an (air)printer has its own local(?) IP adress, and a browser must be able to send text to an URL?
I have very little experience using browser and other internet stuff, hence i put the question here.
If it can be done, i will write some functions to print multi-page reports in a proper way. I used them in the good old DOS period, using Borland's turbo-C.
Picture one, report on screen (and when viewing the printfile).
Picture two, printfile arriving at "Notes" or "Pages"
Picture three, printed by "Pages" after selecting "Courier" font again.