Announcement

Collapse
No announcement yet.

Printing text files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printing text files

    Is there a way to print a form feed
    without advancing the print position
    so the next page prints at the current position?
    Code:
    OPEN "LPT1" FOR OUTPUT As #1
    PRINT #1, CHR$(12);
    CLOSE #1
    
    The code above form feeds, but the print head 
    will be 1 position to the right.
    
    Can't use PRINT #1, CHR$(12) because it
    issues a carriage return/line feed and if
    the file printing is at end of file some dot-matrix
    printers advance an extra page because of the 
    trailing chr$(13) and char$(10).
    
    Do I have to PRINT #1, CHR(8)+Chr$(12);
    each time a CHR$(12) is found in a file to print
    that does not have a carriage return/line feed after
    the form feed and characters follow the form feed?
    
    I wrote a print manager that prints text files
    and files can have embedded form feeds that sometimes
    need to surpress advancing the print head to line-up
    on the next page.
    
    Should I be using another print mode?

    ------------------


    [This message has been edited by Mike Doty (edited September 26, 2000).]
    How long is an idea? Write it down.

  • #2
    Often the behavior "Form feed implies CRLF" is defined by the PRINTER, not the software.

    You may need to count characters (or use LPOS) to track where you are on the line and advance there after issuing FF.

    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Another possibility would be to use

      print #1;chr$(12);
      instead of
      print #1,chr$(12);

      I have discovered that somewhere in the printing process, the
      comma is sometimes interpretered as a CR/LF. Using the
      semi-colon suppresses this.


      ------------------
      There are no atheists in a fox hole or the morning of a math test.
      If my flag offends you, I'll help you pack.

      Comment


      • #4
        Mel, I have no idea where/how you came up with that one... Can you give us a specific example or code that can prove this statement?

        Mike, the best answer here is from Mr Mattias...

        How are *you* counting your character positions? Remember that LPOS cannot decypher printer control codes from printable characters, so you have to allow for this in any code that needs to track the current "physical" position (rather than the "logical" position as reported by LPOS, etc).

        The same problem can occur when using TAB() after sending control code(s).


        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Code:
          MCM,
          Now using:
          CRFF$ = CHR$(13) + CHR$(12)
          PRINT #1, CRFF$;
          Works great.  Thanks all.
          ------------------
          How long is an idea? Write it down.

          Comment

          Working...
          X