Solved

Printing from ASP

Posted on 2002-07-23
10
210 Views
Last Modified: 2012-06-27
How can I print a text file from ASP?
0
Comment
Question by:insight974
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7172835
Please maintain your open questions:
Help Desk System Date: 03/07/2002 07:00AM PST
http://www.experts-exchange.com/dbgen/Q_20274436.html
Granulated security Date: 06/13/2002 11:40AM PST  
http://www.experts-exchange.com/msaccess/Q_20311369.html
URL Date: 06/27/2002 06:57PM PST
http://www.experts-exchange.com/crystal/Q_20317178.html
(the above question shold be deleted as there are no contributions)
Authentication without asking for user name and password Date: 04/05/2002 06:44AM PST
http://www.experts-exchange.com/asp/Q_20285302.html

Thanks,
Anthony
0
 
LVL 3

Expert Comment

by:mastallama
ID: 7172877
Anthony's correct, the answer to your question isn't to complicated...but why answer it if i don't think i'll get the points anyway??

 ~ MastaLlama ~
0
 
LVL 2

Expert Comment

by:zombeen
ID: 7173466
<a href="javascript:window.print();">Print</a>
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:DreamMaster
ID: 7173744
zombeen is right, that's the easiest way..it won't always work but it's close enough. There's no way in ASP to execute special print commando's so don't go hoping for that, just accept zombeen's comment and off you go...

Max.
0
 

Author Comment

by:insight974
ID: 7174109
Thank you for the answers. I'm sorry about the delay in the responses. I was making a mistake when giving the points, I was thinking I was closing the questions and that wasn't happening. I'm really very sorry. And in one case, I haven't received any response. Thanks to acperkins for letting me know, I really feel bad about it. I have just reviewed the previous questions and closed them. Sorry.

Related to this question, what I need is to print a text file that was saved in the hard drive. Thank you
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7174806
Use the FSO to open the file as a formated string, then pass that to the print() function.

But if this .txt file is on the users hard-drive, you will have problems... the only other way around it is to upload the .txt to the server, then run it through the print() and then delete the file.
0
 

Author Comment

by:insight974
ID: 7174989
Let me explain more. I have a variable with a string in the asp page, what I will need is to print that string (to the default printer). As I don't have an idea on how to do it I was thinking on creating a temp txt file and send the file to print but I'm open to other ideas.
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 100 total points
ID: 7176137
Like I said, write the string to a temp file with the FSO, then call print() from the file;

Sub CreateAfile
   Dim fso, MyFile
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)
   MyFile.WriteLine("This is a test.")
   MyFile.Close
End Sub

' Now redirect to the print.asp file
' it would be better to open a new window to do this
Response.Redirect "print.asp"

--------------------print.asp-----------------------

<!--#include file ="c:\testfile.txt"-->
<html>
<head>
<script language="javascript">

function printPage()
{
     window.print()
     // Now close the window
     window.close()
}
</head>
<body onLoad="javascript:printPage();">

0
 
LVL 33

Expert Comment

by:hongjun
ID: 7348972
This question appears to have been abandoned. I will invite a Moderator to close this question if there's no reply from you after seven days.

Suggestion
<points to mgfranz>


hongjun
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7373630
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
asp classic find word in string and get its value 7 45
ASP get fieds value 2 38
ASP Error Handler 5 33
ms sql string field to asp variable as number 5 29
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question