How Do I send buffer to Printer ?

Discussion in 'ASP General' started by Jay Villa, Aug 16, 2005.

  1. Jay Villa

    Jay Villa Guest

    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
     
    Jay Villa, Aug 16, 2005
    #1
    1. Advertising

  2. Jay Villa

    [MSFT] Guest

    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], Aug 17, 2005
    #2
    1. Advertising

  3. Jay Villa

    Jay Villa Guest

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


    "[MSFT]" <> wrote in message
    news:YD$...
    > 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, Aug 17, 2005
    #3
  4. Jay Villa

    [MSFT] Guest

    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], Aug 18, 2005
    #4
  5. Jay Villa

    Jay Villa Guest

    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]" <> wrote in message
    news:$...
    > 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, Aug 18, 2005
    #5
  6. Jay Villa

    [MSFT] Guest

    That should be nice work around. Thank you for update

    Luke
     
    [MSFT], Aug 19, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Samuel Lee
    Replies:
    0
    Views:
    558
    Samuel Lee
    Nov 11, 2003
  2. Raja
    Replies:
    12
    Views:
    24,702
    John Harrison
    Jun 21, 2004
  3. Replies:
    2
    Views:
    634
    sergejusz
    Mar 26, 2007
  4. Neal Becker

    buffer creates only read-only buffer?

    Neal Becker, Jan 8, 2009, in forum: Python
    Replies:
    0
    Views:
    428
    Neal Becker
    Jan 8, 2009
  5. Replies:
    5
    Views:
    179
Loading...

Share This Page