Urgent

manujmathew

New Member
The progress version is PROGRESS 10.1C,OS is UNIX AIX(5.1).I need a program or code which on execution pushes the files from a particular folder to any printer.The folder may contain pdf files or any other files.
 

TomBascom

Curmudgeon
Code:
define variable fname as character no-undo.
input from os-dir( "." ) no-attr-list.
repeat:
  import fname.
  if fname begins "." then
    next.
   else
    do:
      display fname.
      os-command silient value( "lp " + fname ).
    end.

end.
 

sphipp

Member
That's quite tricky under Unix, at least I think it is.

Finding the files in a directory is fairly easy - OS-DIR gives you the list of files, you can import them into a Temp-Table and then process each one individually.

However, printing each file is the difficult part.

Under Windows you would have a procedure than checks the file extension and then launches a routine that prints files of that extension. However, even this is not easy as you will have multiple extension types that each require different methods of printing.

For example, printing a .PDF file under Windows is different than printing a .DOC file or a .TXT file.

Under Unix, you will probably have difficulties in being able to print off each file format. I have only had experience in printing flat files on Unix printers, but I am guessing that this is very tricky indeed. Simply catting the file and piping it through lp won't work here, which is how Unix files are generally printed.

You also have a problem in what to do with file extensions that your program does not recognise. You might need a list of valid extensions with print routines and anything else might be treated as an exception that cannot be printed.

Do you really want to be able to print all files in a single directory, no matter what the extension? Or do you have a list of file extensions that are likely to be in the directory and want to print those?

Have you searched Progress Talk or PEG to see if someone has already found a solution?
 

LarryD

Active Member
I don't know about AIX, but generally for at least linux with CUPS to print a pdf file you need to do the following and convert the pdf to a post-script using the pdf2ps script piping the lp command (the dash is required):

Code:
os-command silent value ('pdf2ps ' + trim(pdf-file-name) + ' - | lp -s -d ' + destination-printer).
 

sphipp

Member
Is lp extension/context-aware?

I didn't think it was, at least I have gone through a ream of paper by using it in the past.
 

LarryD

Active Member
pdf2ps is installed when you install Ghostscript. On linux, this is installed with CUPS. I have no experience with AIX, but google is your friend.

Google for "AIX pdf2ps download", and you can find the download sites. According to what I found it's on the AIX toolbox CD, and it is downloadable from the IBM website, but it may or may not be AIX version specific.
 

TomBascom

Curmudgeon
You really need to talk to your system admin and maybe even do a little experimentation.

For an overview of CUPS: wikipedia

It is possible, maybe even likely, that you don't need to do anything more than "lp filename" and the system will magically figure out what sort of file it is and do the right thing. If it takes more than that then the details are going to vary depending on how your admin went about setting things up on your particular server and there is no simple generic answer that we can give you.
 
Top