W
W. eWatson
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?
to skip to the top of the page. It doesn't work. Comments?
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?
Apparently not with with my Brother 1440 laser printer. The character inGrant said:Yes, it does work.
W. eWatson said: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.
I should mention I'm using Windows. I just put chr(12) right in the txt.Tim said: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
W. eWatson said: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?
I am writing a txt file. It's up to the user to print it using NotepadTim said: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).
W. eWatson said:I am writing a txt file. It's up to the user to print it using Notepad
or some other tool.
W. eWatson said: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).
Could be, but I have no way of easily knowing. In any case, I was tryingMensanator said: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.
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?
Neil said:WordPad will interpret chr(12) as you want.
Neil
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.![]()
D'Arcy J.M. Cain said: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.
I am writing a txt file. It's up to the user to print
it using Notepad or some other tool.
Nobody said:The 1970's are over, and neither Notepad nor your printer attempts to
maintain compatibility with a Teletype model 37.
Or unless you are printing to a production mailing system, and don'tLie said: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.
John said: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.
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
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.