For Programmers: Free Programming Magazines  


Home > Archive > ASP > August 2005 > How Do I send buffer to Printer ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How Do I send buffer to Printer ?
Jay Villa

2005-08-16, 5:00 pm

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTemplateFile = objFSO.OpenTextFile(Server.MapPath("template.txt"))

strTemplateText = objTemplateFile.ReadAll
objTemplateFile.Close
Set objTemplateFile = Nothing

strTextToPrint = strTemplateText
strTextToPrint = Replace(strTextToPrint, "{date}", Date())
strTextToPrint = Replace(strTextToPrint, "{time}", Time())
strTextToPrint = Replace(strTextToPrint, "{message}", strMessage)
Response.Write strtexttoprint

How do I send strTextToPrint to my default printer ?

-Jay


[MSFT]

2005-08-16, 9:59 pm

Hello Jay,

Since the strTextToPrint has been send to client browser, I think you can
call "window.print" on client to print current page on default printer.

Luke

Jay Villa

2005-08-17, 8:59 am

Actually I dont want to print entire page only the the contents of
strTextToPrint. window.print.


"[MSFT]" <lukezhan@online.microsoft.com> wrote in message
news:YD$QPStoFHA.944@TK2MSFTNGXA01.phx.gbl...
> Hello Jay,
>
> Since the strTextToPrint has been send to client browser, I think you can
> call "window.print" on client to print current page on default printer.
>
> Luke
>



[MSFT]

2005-08-17, 9:59 pm

Hello Jay,

With client script, we can only print the content of whole page. Anyway, I
think there may be a work aound for the issue: add a iFrame element on your
page (Maybe invisible if necessary). After a fill in data and select the
template, you may display the result page in the iFrame element and call
window.print in it.

Luke

Jay Villa

2005-08-18, 8:59 am

Thanks Luke for your suggestion. Actually I used print window/area as shown
below and it worked as I wanted.

var printWin = window.open("","PrintWindow");
printWin.document.open();
printWin.document.write(sContents);
printWin.document.close();
printWin.print();


"[MSFT]" <lukezhan@online.microsoft.com> wrote in message
news:$Gw8o25oFHA.3120@TK2MSFTNGXA01.phx.gbl...
> Hello Jay,
>
> With client script, we can only print the content of whole page. Anyway, I
> think there may be a work aound for the issue: add a iFrame element on
> your
> page (Maybe invisible if necessary). After a fill in data and select the
> template, you may display the result page in the iFrame element and call
> window.print in it.
>
> Luke
>



[MSFT]

2005-08-19, 4:12 pm

That should be nice work around. Thank you for update

Luke

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com