Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 19, 2021 8:29:19 GMT -5
Hi Is it possible to change the font when using LPRINT to print to a printer? I have searched this forum and the LB Help but cannot find anything. If it is there, then I must have missed it. Regards Dennis Edit: To be more specific, I want to be able to print a report containing different bold and larger characters as headings. I can do this with the ddoc.dll which I have but would like to keep things simple and use only native LB code. Thanks! Edit, Edit: In the "bad old days" we could use printer control codes. Do modern printers still accept them?
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 19, 2021 9:27:42 GMT -5
I could possibly use PCL but I am not too sure if all printer have PCL cpability.
Do they? Is PCL embedded in most printer drivers these days?
|
|
|
Post by Brandon Parker on Dec 19, 2021 10:03:31 GMT -5
Interestingly, the section on setting the printer font for the LPrint command is not listed under the LPrint command reference. It is listed under the PrinterDialog command in the help file. So, from there you can get to the reference material for the PrinterFont$ variable. Basically, you just set the PrinterFont$ variable with a parameter string similar to setting the font of any other control in Liberty BASIC. {:0) Brandon Parker
|
|
|
Post by tsh73 on Dec 19, 2021 11:40:11 GMT -5
Interesting but for me whole page is printed with last selected font. And if I put "dump" between font changes I got two different pages (with different fonts)
PrinterFont$ = "courier_new 20 bold" lprint "Header" 'dump
PrinterFont$ = "Arial 10 " for i = 1 to 10 lprint "Item ";i next dump
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 19, 2021 12:11:59 GMT -5
Thanks Brandon and Anatotoly - you guys came through for me again! I never consideed looking under PrinterDialog and the LPRINT help does not point to it. Your help is much appreciated!
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 19, 2021 12:23:06 GMT -5
Anatoy, The same happen to me If the first dump is left in, I get two pages; Page one with the Bolded and sized heading and page two with the reduced font.
If the first dump is removed then I get a single page with the first Printfont$ not actioned but the line printed.
Is this a bug? If it is, then the Printfont$ approach to LPRINTing will not work...
I need to change fonts on a single page.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 19, 2021 13:08:58 GMT -5
Actually not a bug according to the manual. the manual states it clearly. "The last font set before a page is printed is used for all the text on that page."A DUMP statement then obviously starts a new page. So back to the problem - how to change fonts on the same problem?
|
|
|
Post by Brandon Parker on Dec 19, 2021 15:17:59 GMT -5
Well if you can format your page correctly, then you could set up one run with a specific font and layout, print that, place the paper back into the printer, and run the new font and layout to print anything else.
It would obviously require you to run each page through for each font and layout you need, but it could be done.
{:0)
Brandon Parker
|
|
|
Post by Rod on Dec 19, 2021 15:21:34 GMT -5
Please look at printform.bas for the only viable way to do this. printform.bas ships with Liberty as an example program.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 19, 2021 17:07:27 GMT -5
Well if you can format your page correctly, then you could set up one run with a specific font and layout, print that, place the paper back into the printer, and run the new font and layout to print anything else. It would obviously require you to run each page through for each font and layout you need, but it could be done. {:0) Brandon Parker I agree that it could be done but I doubt wether the buyers of the software would be prepared to do that with the 21 odd reports the system produces... :-) I will use the ddoc dll which I have - it allows font changes but it is finicky to set up. Thanks though
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 19, 2021 17:15:52 GMT -5
Please look at printform.bas for the only viable way to do this. printform.bas ships with Liberty as an example program. Hi Rod. I seriously considered using the "printform" approach but rejected it because the reports that I need to produce are multipage, contain tons of variable data off a database, and almost difficult to predict what combination of data the the user might select to print. I need to print "continuous" reports and not a form at a time. I must admit though that printforms looked seductive when I looked at it about a month ago. I have decided to go with the ddoc dll approach as replied to Brandon. A pity because I really thought the Printerfont$ "thingie" could have been the answer... Regards Dennis
|
|
|
Post by Rod on Dec 20, 2021 3:27:31 GMT -5
Formatting the data is a challenge. But you have to do that anyway and I can’t recall the last time I saw continuous stationery in an office. It’s all A4 or Foolscap single sheet. Which means it should just be headers and footers and paged data then repeat.
The question has come up once or twice, when I get a bit of time I will do a demo of multi page printing. Of course Lprint still works well but single font, black and white. But that’s why we know how to do multi character large letter printing,! Golden olden days.
|
|
|
Post by Brandon Parker on Dec 20, 2021 9:22:32 GMT -5
I agree that it would not be a good approach for software that is going to be used by a customer.
The printform.bas approach, as suggested by Rod, would probably not be that much more difficult than the DLL approach. Once you get the internal logic situated in the program to format any data, printing would go very quickly.
{:0)
Brandon Parker
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Dec 20, 2021 12:16:59 GMT -5
Hi Rod/Brandon Rod, I think you misunderstood the word "continuous". I was not referring to the paper with sprocket holes down the sides and perforations! I haven't seen lineprinters for some time now. I use 3 printers for different purposes - Brother A4/A2 InkJet, Canon Colour InkJet, and an HP laser printer. By continuous, I meant that the reports are not single form reports but lists of varying length. Imagine listing 1000 items of varied format form by form. There would of course be common formats but there could be approximately 30 different page formats. After some hassle, I got everything working using the ddoc dll which I had used before with other BASICs. I was hoping to not have to use it. Brandon you are quite correct that with a bit of logic and time I could get a forms approach to work. But unfortunately time is of the essence (14 days to deadline) and after 55 years of programming I am always looking for the lazy way out Thanks to both for your assistance and responses though - much appreciated. Regards Dennis
|
|
|
Post by gidiom2 on Dec 24, 2021 16:22:42 GMT -5
A bit late in the day if you have a deadline (10 days now?), but using Alyce's lbbrowse3.dll makes it easy to generate HTML reports enabling font/style/font colour, tables, etc to be printed. There were examples in LB newsletters but I can't locate them. It was an ideal way to print muli-colour, multi-font reports.
|
|