chr(12) Form Feed in Notepad (Windows)

Tim Chase python.list at tim.thechases.com
Fri Jan 15 18:19:26 EST 2010


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





More information about the Python-list mailing list