Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

printing an ASCII file to a Network-Printer

keghebo
Beginner
410 Views

(Win 2000, CVF 6.5)

I am having some problem in the apparently
simple task of printing a closed ASCII file to
a Network Printer defined as default printer.

I tried, without success:

!- first attempt ---------------------
USE MSFLIB
logical(4) result
open(unit=1,file='d:mydirmyfile.txt',status='old')
close(unit=1,disp='PRINT')
pause
end
!- end first -------------------------


tryed, without success:
!---- Second attempt ----------------
...
call SYSTEMQQ('PRINT /d:PRN_NAME myfilename.txt')
...
!--- end second attempt -------------



tryed, without success:
!---- Third attempt ----------------
...
call SYSTEMQQ('PRINT /d:PRN_PORT_NAME myfilename.txt')
...
!--- end third attempt -------------

Whar could I do?

Thanks,
ke


0 Kudos
3 Replies
durisinm
Novice
410 Views
If the file is just ASCII text you can write a loop that reads a line at a time and copies it to the printer device. I have done a similar thing in the past.

You could also try the printing program that Steve Lionel developed and has mentioned in this forum. I don't recall its name at the moment, though.

Mike
0 Kudos
isn-removed200637
410 Views
There is a shareware program called PCPS32.EXE for
windows (versions for UNIX and other systems also
available) that I use to send an ASCII text file to
a network printer.

After mapping lpt3 to the printer using, for example:
NET USE LPT3: servernameprintername

Iwould then use batch files with the filename as argument, thus:
PSPORT FILENAME.TXT
PSLAND FILENAME.TXT

for portrait and landscape orientations.
These commands can be issued using calls to SYSTEMQQ etc. The batch files are:
@ECHO OFF
REM FILE:     PSPORT.BAT
REM COMMAND:  PSPORT filename
REM FUNCTION: TO CALL PCPS32.EXE TO PRINT AN ASCII FILE filename
rem           TO A POSTSCRIPT PRINTER QUEUE
REM           LPT3 IS PRESENTLY DESIGNATED AS THE POST-SCRIPT PRINTER.
REM     
REM           THE FLAG -ro- KEEPS PORTRAIT ORIENTATION BY SUPPRESSING
REM           THE ROATATION THROUGH 90 DEGREES WHICH GIVES LANDSCAPE
REM           THE FLAG -qu SUPRESSES ALL BUT THE MINIMUM SCREEN OUTPUT
REM           THE FLAG -of DEFINES THE POST-SCRIPT PRINTER QUEUE OR FILE
REM           THE FLAG -fo DEFINES THE FONT -foc8 DEFINES COURIER 8-POINT
IF "%1" == "" GOTO NOFILE
C:PCPSPCPS32.EXE -ro- -foc8 -qu -ofLPT3 %1
GOTO EXIT
:NOFILE
ECHO NO FILENAME GIVEN TO PSPORT...IGNORING COMMAND
:EXIT
and
@ECHO OFF
REM FILE:     PSLAND.BAT
REM COMMAND:  PSLAND filename
REM FUNCTION: TO CALL PCPSD.EXE TO PRINT AN ASCII FILE filename
rem           TO A POSTSCRIPT PRINTER QUEUE
REM           LPT3 IS PRESENTLY DESIGNATED AS THE POST-SCRIPT PRINTER.
REM     
REM           THE FLAG -ro ROTATES THE OUTPUT TO LANDSCAPE FORMAT
REM           THE FLAG -qu SUPRESSES ALL BUT THE MINIMUM SCREEN OUTPUT
REM           THE FLAG -of DEFINES THE POST-SCRIPT PRINTER QUEUE OR FILE
REM           THE FLAG -fo DEFINES THE FONT -foc8 DEFINES COURIER 8-POINT
REM
IF"%1"=="" GOTO NOFILE
C:PCPSPCPSD.EXE -ro -foc8 -qu -ofLPT3 %1
GOTO EXIT
:NOFILE
ECHO NO FILENAME GIVEN TO PSLAND...IGNORING COMMAND
:EXIT

HTH.
0 Kudos
Steven_L_Intel1
Employee
410 Views
The program (actually a callable routine) Mike refers to is on the CVF kit sample area as FORPRINT - you can also get a copy of it here

Steve
0 Kudos
Reply