[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LYNX-DEV Contents of <TITLE> tag at top of printed page
From: |
J. Kevin Ternes |
Subject: |
LYNX-DEV Contents of <TITLE> tag at top of printed page |
Date: |
Thu, 28 Aug 1997 08:40:19 +22324924 (EDT) |
Klaus Weide wrote:
>On Thu, 21 Aug 1997, Kevin Ternes wrote:
> > There is a requirement where I work to have the contents of the <TITLE>
> > tag displayed at the top of each printed page the way that Netscape
> > does.
> >
>
> I suggest doing this outside of lynx, with a small shell script, perl
> script, C program or whatever you like. That could split up Lynx's
> output into pages (according to your printer's page length) and insert a
> Title line for each page. Or maybe even your lpr (or equivalent) can do
> this for you. Add or change the PRINTER: definition in lynx.cfg to use
> your external command.
>
> The only change required in the Lynx code then would be to make it pass
> the title to your command. The simplest way to do this probably would be
> to putenv() an environment variable (LYNX_PRINT_TITLE or whatever) before
> the relevant `system(buffer);' command under `case PRINTER:', and make
> your command use that variable. The title as seen by Lynx should be
> available through HText_getTitle() or HTLoadedDocumentTitle() any time in
> printfile() after the HTLoadAbsolute(&WWWDoc) near the top.
Excellent! This worked great. I only modified LYPrint.c
by inserting the following two code fragments into printfile():
char *envbuffer = NULL; /* WebSter Print Mods -jkt */
in the declaration area, and
/* Begin WebSter Print Mods - jkt */
StrAllocCat(envbuffer, "LYNX_PRINT_TITLE=");
if (HText_getTitle())
StrAllocCat(envbuffer, HText_getTitle());
else
StrAllocCat(envbuffer, NULL);
putenv(envbuffer);
/* End WebSter Print Mods - jkt */
between the printf(PRINTING_FILE) and fflush(stdout) calls.
As for the external script, it's just a shell script that makes
sure that all of its parameters make sence, then executes
pr -h "$LYNX_PRINT_TITLE" | lp -d $PRINTDEST
Actually, pr is kinda lacking in options. I'm still looking
for some better formatter. I'll let you know.
Thanks Klaus!
-jkt
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;