No announcement yet.

PB4.04 Console set screen with full screen.

  • Filter
  • Time
  • Show
Clear All
new posts

  • PB4.04 Console set screen with full screen.

    Hi all,

    I've now converted my ancient QBX programmes into Powerbasic and they really fly (well, as much as any 20,000 line project hooked up to Novell3.2 can 'fly').

    We have a couple of programmes that need 50 line mode, so I'm using Console Set Screen to switch and then switch back to 25 lines when I'm finished.

    I'm now almost certain (having stuck debug code before and after) that Console Set Screen is coming back with occasional Illegal Function Calls - this doesn't happen every time, but is really worrying.

    I'm not doing anything bizarre with screen sizes, I just want 50 line and 25 line modes.

    As a last resort I've just re-written all my Console Set Screens to call a single function which checks the current screen size, and then only if it's different to what's been requested, the Console Set Screen is issued.

    Has anyone else had anything similar?

    Are there any other Windowsy ways to change screen size (which wouldn't report the error) - I'm know I could 'trap' this error, but it'd be nice to know what's causing it.

    Regards, John

  • #2
    What OS version are you using?
    Rick Angell


    • #3
      I'm using XP Home and XP Pro, with a minimum of SP2.

      Regards, John


      • #4
        I've looked further into this and I can't recreate this using a small piece of code, but I think it's probably worth mentioning that I shell out to LPR to do all my printouts, and I suspect that something that LPR is doing is randomly breaking my console set screen.

        And before you ask, the reason I use LPR is our programmes were written to go to laserjets, using various bodges along the way:-

        I made a copy of our invoice stationery under Word, using graphics files, lines etc.etc, then printed that to a PCL printer on FILE:, which then gave me a blank invoice template.

        My BASIC programmes then suck this file in, up until the point where they recognised the "end of page" script. The programme then prints this and repositions the laser 'cursor' and I then print the invoice contents onto the template - and there you go, invoices printed in BASIC using full PCL.

        The advantage this gives us then is we can use PCL2PDF.EXE from Visual to convert that PCL file to a PDF and then email that out to the customer (previously I used various DOS utilities to do the emailing, I can now do it all internally in PB)

        So, has anyone got an LPR client for PB I could use? (which would mean I don't have to SHELL out for anything)

        Regards, John


        • #5
          Originally posted by John Balshaw View Post
          I made a copy of our invoice stationery under Word, using graphics files, lines etc.etc, then printed that to a PCL printer on FILE:, which then gave me a blank invoice template.
          why not scan the invoice form to an image then read it in PB, drawtext on it, etc etc?


          • #6
            Hi Chris,

            This is something that wouldn't have been an option with my old PDS programmes - the size of a full page A4 scan at decent quality is huge.

            Also, it wouldn't work for the PCL->PDF conversion we do.

            Regards, John


            • #7

              Have you tried using the XPrint functions to do the whole printing job?
              If you've got the LJ printers installed in Windows then it should be able
              to print most everything. It might take a little while to create the stock
              invoice form but it would eliminate any extra files needed for the print.
              Using the XPrint Attach, you could print to a PDF maker program to
              get the PDF output. It shouldn't be too hard to do a simple form and
              fill in some dummy data just to see if it works.


              • #8
                Originally posted by John Balshaw View Post
                Also, it wouldn't work for the PCL->PDF conversion we do.
                My guess is that you are tied to PCL for some reason, performance maybe? Or some part of your documentation set (invoice etc) is a legacy application generating PCL? Otherwise, why not just take it out of the loop?


                • #9
                  Or, I can go the even easier route of LPRINT.

                                  OPEN Uniq$ FOR BINARY ACCESS READ AS #TempFile%
                                  GET$ #TempFile%,LOF(#TempFile%),TempStr$
                                  CLOSE #TempFile%
                                  LPRINT ATTACH LaserPrName$
                                  IF Copies% = 0 THEN Copies% = 1
                                  FOR TempCop% = 1 TO Copies%
                                      LPRINT TempStr$;
                                      LPRINT FLUSH
                                  LPRINT CLOSE
                  Which works like a charm, but LPR based printing gives me real bonuses - I can print files out in remote branches.

                  The hard-wired PCL side of things doesn't really worry me - I know I can convert to XPRINT at a later date, but time has been of the essence in getting the programmes up as quickly as possible, I'd guess that I'd need a fortnight of hard slog to get XPrint working sweetly with our invoice, delivery and statement stationery.

                  I also can't over emphasise the flexibility of being able to take any of my current printouts and convert it to a PDF and then email it to anyone completely under programme control (sales reports to reps, stock lists, statements and invoices to customers), converting to XPrint means I then have to come up with another print to PDF routine (which I'm guessing will mean more investment in another PDF conversion programme).

                  Regards, John
                  Last edited by John Balshaw; 26 Sep 2008, 06:54 AM.


                  • #10
                    Printing forms

                    I had the same problem and here was my solution :

                    I simply scanned the form and saved only the topmost part of the BMP file and Xprint it with the RENDER command.
                    This is where most of the artwork usually is.
                    The balance of the form is done with Xprint Graphics. Lines and boxes are pretty eazy to make.
                    Since there is no printing on the rendered part, there is no alignment problem.
                    As for PDF output, I use the Free Program FrePrimoPDF as Printer and the rendered part will be perfectly done with all original colors.
                    Last edited by Guy Dombrowski; 26 Sep 2008, 09:46 AM.
                    Old QB45 Programmer


                    • #11
                      > As for PDF output, I use the Free Program FrePrimoPDF as Printer
                      > and the rendered part will be perfectly done with all original colors.

                      I suspect this will be the problem which won't go away.

                      We've bought a site license for PCL2PDF, which means any machine can generate a PDF (completely invisibly)

                      I guess FreePrimo is a print driver, which means it'll have to installed on every machine - how much control do you get over the print driver? Can you specify where you want the saved .PDF to print, or do you have to cope with popup "Save as" boxes?

                      Regards, John


                      • #12
                        >why not scan the invoice form to an image then read it in PB, drawtext on it, etc etc?

                        I actually did that.. well, the customer scanned the forms (I did not have a scanner at that time) and saved as JPEG or BMP or something. (UB-92 and HCFA 1500 forms... not that you can't pick up image files for those in less than maybe 184,238 different places on the Internet).

                        Paint Image, draw text on top of it. Looks just like Ye Olde "please load forms to printer and press <Enter> when ready" output.

                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]


                        • #13
                          Yes, I realise that I can scan/print and the print over the top, but if I try to stick a huge bitmap image through a PDF converter, I'll end up with a similarly huge PDF as it won't be able to do anything with the bitmap.

                          If I'm going to do the work to convert to XPRINT, I might as well do the job properly and draw the graphics myself (or at least the boxes and cross-hatching, the logo I'm happy to 'scan'n'paint').

                          Regards, John


                          • #14

                            In post #4, you mention that your programs suck up the PCL file and print
                            it. Exactly how? and you mention that you then reposition the laserjet and
                            print the rest of the data. Is this done via PCL commands? If not then
                            how do you get a PURE PCL output file?

                            By the way, exactly what is LPR? I'm guessing some sort of file-to-printer
                            program but am curious as to its details. is it specifically for PCL output
                            and how do you specify which printer gets the ouput.

                            You don't seem to want to change your programs and I can see why. But
                            maybe the external programs are what's causing any console problems
                            you're having. Just a thought.


                            • #15
                              Hi Paul,

                              My programme reads in all but the last 12 characters of the template (which are formfeed, end of job characters) - this probably changes from PCL printer driver to PCL printer driver, but I've concentrated on the HP LJ4 as it gives a sensible resolution of 300DPI.

                              I suck this all into an array, then blow it out to the printer, I then use direct PCL commands to reposition the laser cursor to '1/1'

                              IE:- PRINT #Prout%, CHR$(27); "&a1R"; CHR$(27); "&a1C";

                              I then set font type, italics etc as I'm going.

                              Yes, LPR is a basic computer to printer protocol which needs an LPR daemon running on the destination machine/printer - every ethernet printer I've ever come across has LPR server, so it became a 'lowest common denominator' type of thing as we're moving away from Novell and their proprietory print spooler commands.

                              But as a result of playing around earlier today I've now consigned LPR to the bin (or at least to a back seat) as I can achieve everything I need using LPRINT ATTACH, so the request for the LPR client is now irrelevant. I'm no longer shelling out of my programme all the time, I only need to shell out for my PDF conversion, but I've had no problems with that (so far)

                              Regards, John


                              • #16

                                I've done the same thing or very similiar using a plotter, where a one time customer demanded the back ground or original drawing sheets I do my work on be printed in original Autocad format (so mine looks identical as other sheets). Generally speaking I found out that the print process does not start until the paper feed command is sent. By clipping this command and reset plotter head position (virtual) and then sending my overlay I was able to print a full drawing sheet using a combo of Autocad & Versacad.

                                That was many years ago


                                • #17
                                  Hi Nick,

                                  Yes, you're (were) doing just the same as me, chop out the bit that starts printing and insert your own chunk in it's place, probably akin to brain surgery with a half-brick, but it does the job.

                                  I'm interested in using a PDF printer driver with XPRINT (it's a huge job to rewrite all my printer routines, but Christmas is coming and a fortnight should be enough time to get it all cracked) - there's only a couple of people in each branch who'd need to create a PDF, and the programme should be able to figure out whether it's pdf-capable by interrogating PRINTER$, but I'd like this to happen 'invisibly' to the user. My experience with CutePDF and PDF995 is that both popup with a filename request. Is there any way to suppress this and replace it with my own location/filename?

                                  Regards, John


                                  • #18
                                    PDF Printer


                                    You might try the Freeware TXTTOPDF.EXE printer.
                                    This will make a PDF file with any TXT file without any action from the operator.
                                    All you need to do is output text file to a sequential file and run TXTtoPDF.EXE with a shell command to process it.
                                    No operator action needed.
                                    The only down side is that no graphical image can be included but for simple PDF report, it is perfect.
                                    Old QB45 Programmer