Re: chr(12) Form Feed in Notepad

2010-01-17 Thread bartc


"Dennis Lee Bieber"  wrote in message 
news:mailman.1021.1263702437.28905.python-l...@python.org...

On Sat, 16 Jan 2010 23:59:52 GMT, "bartc"  declaimed
the following in gmane.comp.python.general:


My point was these other control codes from over 30 years ago are still 
in

use today, so why not also make use of chr(12)?


 worked with old style text-only printers, where it triggered
the paper to move until a marker in a control tape matched. These
printers had known line spacing and column width (and did not wrap
text)...

Printing from Word/WordPad/NotePad doesn't follow that easy behavior
(in WordPad you can have text wrap to window, but it gets sent to a
printer as one long line which may or may not wrap depending on the
printer). A Text-only printer probably honors , but most all
printers in Windows are defined as graphical -- what is sent is a
bit-image of the data as rendered in a memory buffer at printer
resolution.

At that level, it is dependent upon what the printer driver and GDI
do when receiving a non-printable byte value...


Until recently at least printers were non-text-only but did not necessarily 
accept only bitmap images. For example they might use Postscript, HP/PCL or 
Epson Esc/p (or whatever the exact names were). I'm fairly certain the last 
two responded directly to chr(12) codes in the input stream.


Windows may or may not drive these in bitmap mode (which can be simpler for 
Windows, but then you lose any special processing available inside the 
printer), but given the task of sending a TXT file to such a printer, it is 
not unreasonable to expect it to honour codes such as CR, LF and FF, 
especially as most printers seem to be page-oriented now rather than use 
roll or fanfold paper.


It would just need to translate FF into the page-break command for the 
printer in question, eg. send the image so far and eject the page, just as 
it might do for EOF.


--
bartc 


--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-16 Thread Ben Finney
Grant Edwards  writes:

> FF still works with a lot of things.  Most ASCII printers still
> honor it, as do pagers and programs like a2ps.  I still use it
> in ASCII text files...

Yes. It's especially useful for making large sectional structure in a
text file — for example, program source code — that can then be easily
navigated “by page” with a text editor like Emacs or Vim.

Since it's a standard white space character by definition, it can go
anywhere that white space can go; and yet it acts to signal structure
within the file.

-- 
 \  “There's a certain part of the contented majority who love |
  `\anybody who is worth a billion dollars.” —John Kenneth |
_o__)Galbraith, 1992-05-23 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-16 Thread Grant Edwards
On 2010-01-16, Nobody  wrote:
> On Fri, 15 Jan 2010 10:42:43 -0800, W. eWatson wrote:
>
>> I thought I'd put a page break, chr(12), character in a txt file I wrote 
>> to skip to the top of the page. It doesn't work. Comments?
>
> The 1970's are over, and neither Notepad nor your printer attempts to
> maintain compatibility with a Teletype model 37.

FF still works with a lot of things.  Most ASCII printers still
honor it, as do pagers and programs like a2ps.  I still use it
in ASCII text files...

-- 
Grant


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-16 Thread bartc


"Steve Holden"  wrote in message 
news:mailman.1007.1263682208.28905.python-l...@python.org...

bartc wrote:


"Nobody"  wrote in message
news:pan.2010.01.16.04.24.18.437...@nowhere.com...

On Fri, 15 Jan 2010 10:42:43 -0800, W. eWatson wrote:

I thought I'd put a page break, chr(12), character in a txt file I 
wrote

to skip to the top of the page. It doesn't work. Comments?


The 1970's are over, and neither Notepad nor your printer attempts to
maintain compatibility with a Teletype model 37.


Odd that TXT files under Windows still use the same 13 (carriage
return), 10 (linefeed) and 9 (tab) codes that used to work on my ASR 33.
So why not code 12 (formfeed)?


Because the KSR/ASR33 devices were designed for continuous output in
things like torn-tape and torn-paper messaging systems (where I believe
Cable and Wireless made a lot of  money once upon a time). There was no
point paginating the copy, and to do so would have been wasteful.


My point was these other control codes from over 30 years ago are still in 
use today, so why not also make use of chr(12)?


--
Bartc 


--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-16 Thread Steve Holden
bartc wrote:
> 
> "Nobody"  wrote in message
> news:pan.2010.01.16.04.24.18.437...@nowhere.com...
>> On Fri, 15 Jan 2010 10:42:43 -0800, W. eWatson wrote:
>>
>>> I thought I'd put a page break, chr(12), character in a txt file I wrote
>>> to skip to the top of the page. It doesn't work. Comments?
>>
>> The 1970's are over, and neither Notepad nor your printer attempts to
>> maintain compatibility with a Teletype model 37.
> 
> Odd that TXT files under Windows still use the same 13 (carriage
> return), 10 (linefeed) and 9 (tab) codes that used to work on my ASR 33.
> So why not code 12 (formfeed)?
> 
Because the KSR/ASR33 devices were designed for continuous output in
things like torn-tape and torn-paper messaging systems (where I believe
Cable and Wireless made a lot of  money once upon a time). There was no
point paginating the copy, and to do so would have been wasteful. An
operator would just hit CRLF a few times (in fact a good operator would
only return the carriage once at the start, and then just hit the
requisite number of line feeds.

regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-16 Thread Steve Holden
Lie Ryan wrote:
> On 01/17/10 02:37, W. eWatson wrote:
>> D'Arcy J.M. Cain wrote:
>>> On Fri, 15 Jan 2010 20:17:35 -0800
>>> "W. eWatson"  wrote:
 Could be, but I have no way of easily knowing. In any case, I was
 trying to write a simple report that could be printed with titles at
 the top of each page. If there's another "common" format that I can
 write in to produce the file, that's fine. It may be this is so
 difficult to be impossible. Long, long ago this was no problem. :-)
>>> Why not generate a PostScript or PDF file in the first place?  Check
>>> out reportlab.
>>>
>> New Courier and NotePad produces a good looking result.
>>
>> I'm trying to keep this effort to a minimum. I don't think tracking down
>> how to write PP code PDF code is worth for this effort.
> 
> How about creating a new print job for each discontinuous page? AFAIK,
> modern printer spooler don't continue printing between separate jobs? A
> bit of hackery, but guaranteed to work unless you're using roll paper.
> 
Or unless you are printing to a production mailing system, and don't
want job headers printed or interspersed jobs.

>> In another related effort that I might get involved in, it would be good
>> to be able to produce graphical data as from MatPlotLib and be able to
>> print that to a printer directly from a Python program.
> 
A client of mine just built a web site where output from queries could
be HTML, PDF (Piza and ReportLab) or CSV (just written out). It's not
that hard (though the code isn't open sourced I may be able to get them
to document an outline of the process, or let me (in my copious spare time).

regards
 Steve
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-16 Thread Tim Chase

John Yeung wrote:

In another response, Tim Chase suggested creating an RTF file instead
of plain text.  I think this is your best bet if your goal is to get
page breaks with the least amount of additional effort.

The package he's probably referring to is PyRTF.  I took a quick look
at it and in my opinion it's overkill for your purposes.


Yes, John is correct -- it was PyRTF that I tinkered with (which 
can be overkill if all you want to do is what John describes). 
I'm not well versed in RTF, and he demonstrates:



I am too lazy to have actually read any documentation on RTF, but it's
freely available on the Web should you need to reference i


even in his laziness, he helpfully provided a quick guide on how 
to hand-create simple documents without the addition of a 
full-blown RTF toolkit like PyRTF.


-tkc


--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-16 Thread bartc


"Nobody"  wrote in message 
news:pan.2010.01.16.04.24.18.437...@nowhere.com...

On Fri, 15 Jan 2010 10:42:43 -0800, W. eWatson wrote:


I thought I'd put a page break, chr(12), character in a txt file I wrote
to skip to the top of the page. It doesn't work. Comments?


The 1970's are over, and neither Notepad nor your printer attempts to
maintain compatibility with a Teletype model 37.


Odd that TXT files under Windows still use the same 13 (carriage return), 10 
(linefeed) and 9 (tab) codes that used to work on my ASR 33. So why not code 
12 (formfeed)?


--
Bartc 


--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-16 Thread John Yeung
On Jan 15, 7:40 pm, "W. eWatson"  wrote:
> I am writing a txt file. It's up to the user to print
> it using Notepad or some other tool.

In another response, Tim Chase suggested creating an RTF file instead
of plain text.  I think this is your best bet if your goal is to get
page breaks with the least amount of additional effort.

The package he's probably referring to is PyRTF.  I took a quick look
at it and in my opinion it's overkill for your purposes.  Since RTF is
actually just a markup language, and the only features of it that you
absolutely need are (1) a way to ensure a fixed-width font is used and
(2) a way to insert page breaks, it's probably quickest and simplest
to just throw the markup into the document yourself (well, with
Python) and naming the result with the .rtf suffix instead of .txt.

So, how do you find out what markup to use?  Open WordPad, select the
font you want, type a bit of text, save the file as RTF (this should
be the default), and open up the file in Notepad.  At the top will be
a bunch of setup codes, including the font selection.  Make your
Python program put that whole spiel (including a trailing space or
newline, to separate your text from the last RTF tag) at the top of
your output.  There will be one unmatched curly brace, which you
should close at the end of the document.  On my computer, it looks
like this:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern
\fprq1\fcharset0 Courier New;}}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\f0\fs20

That takes care of the font (and other stuff, but you are interested
in the font).  The only other things you need to do are put
r'\par' (the end-paragraph tag) at the end of each line and r'\page'
at the end of each page.  Again, remember to make sure these tags
don't collide with your actual text.  (I'd use '\\par\n' in place of
'\n' and '\\page\n' in place of chr(12).)  Finally, make sure to end
with a closing curly brace as previously mentioned.

The RTF solution is probably more robust than embedding chr(12) and
telling the user to use WordPad, especially since I saw someone report
on another forum that chr(12) doesn't always work even in WordPad (it
might be dependent on the version of WordPad, or the printer, or
whatever).

I am too lazy to have actually read any documentation on RTF, but it's
freely available on the Web should you need to reference it.

John
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-16 Thread Lie Ryan
On 01/17/10 02:37, W. eWatson wrote:
> D'Arcy J.M. Cain wrote:
>> On Fri, 15 Jan 2010 20:17:35 -0800
>> "W. eWatson"  wrote:
>>> Could be, but I have no way of easily knowing. In any case, I was
>>> trying to write a simple report that could be printed with titles at
>>> the top of each page. If there's another "common" format that I can
>>> write in to produce the file, that's fine. It may be this is so
>>> difficult to be impossible. Long, long ago this was no problem. :-)
>>
>> Why not generate a PostScript or PDF file in the first place?  Check
>> out reportlab.
>>
> 
> New Courier and NotePad produces a good looking result.
> 
> I'm trying to keep this effort to a minimum. I don't think tracking down
> how to write PP code PDF code is worth for this effort.

How about creating a new print job for each discontinuous page? AFAIK,
modern printer spooler don't continue printing between separate jobs? A
bit of hackery, but guaranteed to work unless you're using roll paper.

> In another related effort that I might get involved in, it would be good
> to be able to produce graphical data as from MatPlotLib and be able to
> print that to a printer directly from a Python program.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-16 Thread Tim Chase

W. eWatson wrote:

I am writing a txt file. It's up to the user to print it using
Notepad or some other tool.  I have no idea how to send it
directly to the printer, but I really don't want to furnish
that capability in the program. From Google, The Graphics
Device Interface (GDI).


If you're writing it to a text file and assuming that Notepad is 
smart enough to properly handle form-feeds, I'm sorry, you'll be 
disappointed...this says more about the brain-deadness of Notepad 
than your optimism :-)


If you have a configurable destination, you might be able to do 
something within your Python app like


  if 'win' in sys.platform.lower():
default_dest = "lpt1:"
  else:
default_dest = "/dev/lp0"
  dest = config.get("printer", default_dest)
  f = file(dest, 'wb')
  f.write(my_output_with_ff)
  # optionally
  # f.write(chr(12))
  # to eject the last page
  f.close()

Otherwise, you'd have to write to something a default Windows 
application would know how to handle with embedded 
form-feeds/page-breaks (i.e., not Notepad as the default .txt 
handler).  My first thought would be to export it as RTF (there 
was a good python RTF library I tinkered with one afternoon -- 
it's a quick google away) which should allow embedding 
page-breaks, and even give you a fair bit of additional control 
over other aspects like fonts and styles.


-tkc


--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-16 Thread W. eWatson

D'Arcy J.M. Cain wrote:

On Fri, 15 Jan 2010 20:17:35 -0800
"W. eWatson"  wrote:
Could be, but I have no way of easily knowing. In any case, I was trying 
to write a simple report that could be printed with titles at the top of 
each page. If there's another "common" format that I can write in to 
produce the file, that's fine. It may be this is so difficult to be 
impossible. Long, long ago this was no problem. :-)


Why not generate a PostScript or PDF file in the first place?  Check
out reportlab.



New Courier and NotePad produces a good looking result.

I'm trying to keep this effort to a minimum. I don't think tracking down 
how to write PP code PDF code is worth for this effort.


In another related effort that I might get involved in, it would be good 
to be able to produce graphical data as from MatPlotLib and be able to 
print that to a printer directly from a Python program.

--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread D'Arcy J.M. Cain
On Fri, 15 Jan 2010 20:17:35 -0800
"W. eWatson"  wrote:
> Could be, but I have no way of easily knowing. In any case, I was trying 
> to write a simple report that could be printed with titles at the top of 
> each page. If there's another "common" format that I can write in to 
> produce the file, that's fine. It may be this is so difficult to be 
> impossible. Long, long ago this was no problem. :-)

Why not generate a PostScript or PDF file in the first place?  Check
out reportlab.

-- 
D'Arcy J.M. Cain  |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread W. eWatson

Neil Hodgson wrote:

W. eWatson wrote:


I am writing a txt file. It's up to the user to print it using Notepad
or some other tool.  


   WordPad will interpret chr(12) as you want.

   Neil


That may be the solution. Just tell the end user to copy the file into 
it, and print it there.


I just tried it in Wordpad, and it works, but my --- underlines are 
pushed together. Maybe tabs instead of spaces. The columns past Seq # in 
WordPad may suffer from the characters not being fixed width. Well, a 
little work with WordPad might be enough for users to get it right. 
"Copy txt file into wordpad. Select all the text, and set format to 
fixed (if that's possible.).


Here's what a txt sample looks like. It has line wrap here, and the page 
feed


Date/Time &Station UTC  Seq # Frames Time Span Pix 
Dst Pix/Sec
--- -- ---  - -- - 
--- ---
2008/11/12 17:38:58 WW 2008/11/13 01:38:58  1   Noise data.  Short 
track.
2008/11/12 17:39:24 WW 2008/11/13 01:39:24  2   Noise data.  Short 
track.



  <-PAGE FEED
Date/Time &Station UTC  Seq # Frames Time Span Pix 
Dst Pix/Sec
--- -- ---  - -- - 
--- ---
2008/11/17 22:29:54 WW 2008/11/18 06:29:54 21   Noise data.  Short 
track.
2008/11/18 01:51:36 WW 2008/11/18 09:51:36 22   Noise data.  Short 
track.
2008/11/18 04:05:03 WW 2008/11/18 12:05:03 23   Noise data.  Short 
track.
2008/11/18 17:40:42 WW 2008/11/19 01:40:42 2495  3.17 
48.17   15.21

--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-15 Thread Nobody
On Fri, 15 Jan 2010 10:42:43 -0800, W. eWatson wrote:

> I thought I'd put a page break, chr(12), character in a txt file I wrote 
> to skip to the top of the page. It doesn't work. Comments?

The 1970's are over, and neither Notepad nor your printer attempts to
maintain compatibility with a Teletype model 37.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread W. eWatson

Mensanator wrote:

On Jan 15, 6:40 pm, "W. eWatson"  wrote:

Tim Chase wrote:

W. eWatson wrote:

Tim Chase wrote:

...

program. From Google, The Graphics Device Interface (GDI).


Have you considered the possibility that your printer can't print
raw text files? I had one that would ONLY print Postscript. Embedding
a chr(12) would accomplish nothing, you HAD to use a driver that
would translate chr(12) into the appropriate Postcript codes.

What you're doing MIGHT work for others with different printers.


Could be, but I have no way of easily knowing. In any case, I was trying 
to write a simple report that could be printed with titles at the top of 
each page. If there's another "common" format that I can write in to 
produce the file, that's fine. It may be this is so difficult to be 
impossible. Long, long ago this was no problem. :-)


I suppose I could copy the txt file into wordpad, and print it there.
--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread Neil Hodgson
W. eWatson wrote:

> I am writing a txt file. It's up to the user to print it using Notepad
> or some other tool.  

   WordPad will interpret chr(12) as you want.

   Neil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread Mensanator
On Jan 15, 6:40 pm, "W. eWatson"  wrote:
> Tim Chase wrote:
> > W. eWatson wrote:
> >> Tim Chase wrote:
> >>> The pseudo-pipeline comparison would be
>
> >>>   type file.txt > lpt1:
>
> >>> which would send the raw text file to the printer (assuming it's set
> >>> up on LPT1, otherwise, use whatever port it's attached to in your
> >>> printer control panel); or are you using something like
>
> >>>   notepad file.txt
> >>>   File -> Print
>
> >> I should mention I'm using Windows. I just put chr(12) right in the
> >> txt. It's the first character in the next line of the txt file where I
> >> want to page forward. Not acquainted with GDI. Maybe I need some
> >> sequence of such characters?
>
> > It's not a matter of you controlling the GDI stuff.  Unless you're
> > writing directly to the printer device, printing on Windows is done
> > (whether by Notepad, gvim, Word, Excel, whatever) into a graphical
> > representation which is then shipped off to the printer.  So if you're
> > printing from Notepad, it's going to print what you see (the little
> > square), because Notepad renders to this graphical representation to
> > print.  If you send the file *directly* to the printer device (bypassing
> > the Win32 printing layer), it will send the ^L directly and should eject
> > a new page on most printers.
>
> > -tkc
>
> I am writing a txt file. It's up to the user to print it using Notepad
> or some other tool.  I have no idea how to send it directly to the
> printer, but I really don't want to furnish that capability in the
> program. From Google, The Graphics Device Interface (GDI).

Have you considered the possibility that your printer can't print
raw text files? I had one that would ONLY print Postscript. Embedding
a chr(12) would accomplish nothing, you HAD to use a driver that
would translate chr(12) into the appropriate Postcript codes.

What you're doing MIGHT work for others with different printers.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread W. eWatson

Tim Chase wrote:

W. eWatson wrote:

Tim Chase wrote:

The pseudo-pipeline comparison would be

  type file.txt > lpt1:

which would send the raw text file to the printer (assuming it's set 
up on LPT1, otherwise, use whatever port it's attached to in your 
printer control panel); or are you using something like


  notepad file.txt
  File -> Print


I should mention I'm using Windows. I just put chr(12) right in the 
txt. It's the first character in the next line of the txt file where I 
want to page forward. Not acquainted with GDI. Maybe I need some 
sequence of such characters?


It's not a matter of you controlling the GDI stuff.  Unless you're 
writing directly to the printer device, printing on Windows is done 
(whether by Notepad, gvim, Word, Excel, whatever) into a graphical 
representation which is then shipped off to the printer.  So if you're 
printing from Notepad, it's going to print what you see (the little 
square), because Notepad renders to this graphical representation to 
print.  If you send the file *directly* to the printer device (bypassing 
the Win32 printing layer), it will send the ^L directly and should eject 
a new page on most printers.


-tkc


I am writing a txt file. It's up to the user to print it using Notepad 
or some other tool.  I have no idea how to send it directly to the 
printer, but I really don't want to furnish that capability in the 
program. From Google, The Graphics Device Interface (GDI).

--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread Tim Chase

W. eWatson wrote:

Tim Chase wrote:

The pseudo-pipeline comparison would be

  type file.txt > lpt1:

which would send the raw text file to the printer (assuming it's set up 
on LPT1, otherwise, use whatever port it's attached to in your printer 
control panel); or are you using something like


  notepad file.txt
  File -> Print


I should mention I'm using Windows. I just put chr(12) right in the txt. 
It's the first character in the next line of the txt file where I want 
to page forward. Not acquainted with GDI. Maybe I need some sequence of 
such characters?


It's not a matter of you controlling the GDI stuff.  Unless 
you're writing directly to the printer device, printing on 
Windows is done (whether by Notepad, gvim, Word, Excel, whatever) 
into a graphical representation which is then shipped off to the 
printer.  So if you're printing from Notepad, it's going to print 
what you see (the little square), because Notepad renders to this 
graphical representation to print.  If you send the file 
*directly* to the printer device (bypassing the Win32 printing 
layer), it will send the ^L directly and should eject a new page 
on most printers.


-tkc


--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad (Windows)

2010-01-15 Thread W. eWatson

Tim Chase wrote:

W. eWatson wrote:

Grant Edwards wrote:

On 2010-01-15, W. eWatson  wrote:


I thought I'd put a page break, chr(12), character in a txt
file I wrote to skip to the top of the page. It doesn't work.
Comments?

Yes, it does work.

Apparently not with with my Brother 1440 laser printer. The character 
in NotePad.txt looks like a small rectangle, and on the printed page. 
Same result HP C6180 Photosmart.


But are you sending the raw control codes to the printer, or are you 
sending the image-of-my-text-document to a printer-GDI which then 
renders the as-you-see-it out of the printer?


The pseudo-pipeline comparison would be

  type file.txt > lpt1:

which would send the raw text file to the printer (assuming it's set up 
on LPT1, otherwise, use whatever port it's attached to in your printer 
control panel); or are you using something like


  notepad file.txt
  File -> Print

which renders to an internal image representation and then sends that 
image out to the printer.  If it were a dot-matrix printer, you'd 
here/see the difference in a jiffy -- the raw dump is fast and uses the 
printer's built-in fonts while the render-as-image is slow and NOISY.


One alternative is possibly to set up the "Generic Text" printer as a 
device type and attach it to the same port; I've had fair fortune with 
this letting me control the printer more directly if I want fast dumps 
(particularly on dot-matrix printers) rather than pretty dumps.


-tkc



I should mention I'm using Windows. I just put chr(12) right in the txt. 
It's the first character in the next line of the txt file where I want 
to page forward. Not acquainted with GDI. Maybe I need some sequence of 
such characters?

--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-15 Thread Tim Chase

W. eWatson wrote:

Grant Edwards wrote:

On 2010-01-15, W. eWatson  wrote:


I thought I'd put a page break, chr(12), character in a txt
file I wrote to skip to the top of the page. It doesn't work.
Comments?

Yes, it does work.

Apparently not with with my Brother 1440 laser printer. The character in 
NotePad.txt looks like a small rectangle, and on the printed page. Same 
result HP C6180 Photosmart.


But are you sending the raw control codes to the printer, or are 
you sending the image-of-my-text-document to a printer-GDI which 
then renders the as-you-see-it out of the printer?


The pseudo-pipeline comparison would be

  type file.txt > lpt1:

which would send the raw text file to the printer (assuming it's 
set up on LPT1, otherwise, use whatever port it's attached to in 
your printer control panel); or are you using something like


  notepad file.txt
  File -> Print

which renders to an internal image representation and then sends 
that image out to the printer.  If it were a dot-matrix printer, 
you'd here/see the difference in a jiffy -- the raw dump is fast 
and uses the printer's built-in fonts while the render-as-image 
is slow and NOISY.


One alternative is possibly to set up the "Generic Text" printer 
as a device type and attach it to the same port; I've had fair 
fortune with this letting me control the printer more directly if 
I want fast dumps (particularly on dot-matrix printers) rather 
than pretty dumps.


-tkc



--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-15 Thread W. eWatson

Grant Edwards wrote:

On 2010-01-15, W. eWatson  wrote:


I thought I'd put a page break, chr(12), character in a txt
file I wrote to skip to the top of the page. It doesn't work.
Comments?


Yes, it does work.

Apparently not with with my Brother 1440 laser printer. The character in 
NotePad.txt looks like a small rectangle, and on the printed page. Same 
result HP C6180 Photosmart.

--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-15 Thread Grant Edwards
On 2010-01-15, W. eWatson  wrote:

> I thought I'd put a page break, chr(12), character in a txt
> file I wrote to skip to the top of the page. It doesn't work.
> Comments?

Yes, it does work.

-- 
Grant Edwards   grante Yow! ... bleakness
  at   ... desolation ... plastic
   visi.comforks ...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(12) Form Feed in Notepad

2010-01-15 Thread Duncan Booth
"W. eWatson"  wrote:

> I thought I'd put a page break, chr(12), character in a txt file I wrote 
> to skip to the top of the page. It doesn't work. Comments?
> 
Did you intend to ask a question? If so you might like to read 
http://catb.org/~esr/faqs/smart-questions.html first.
-- 
http://mail.python.org/mailman/listinfo/python-list