[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Using FTPAPI to ftp to a printerfile



Hi Mike,

This is what I have done (procedure copied and translated from:

http://newsolutions.de/forum-systemi-as400-i5-iseries/newsboard-linux/9340-pdf-outq-drucken-von-ifs-2.html

which is a page in German written by KM, I only changed the URL's to download Ghostscript to working ones)

---------------------------------------------------------------------------

1. Download Ghostscript Version 8.54 from:

http://computer-refuge.org/classiccmp/aixpdslib/pub/ghostscript/RISC/5.3/exec/

2. Download appropriate font files from:

http://code.google.com/p/ghostscript/downloads/detail?name=ghostscript-fonts-std-8.11.tar.gz&can=2&q=

3. Save both files on the IFS in /QopenSys and use "call qp2term" to open    the pase shell. From the shell, use command

tar -xf "Filename"

on both the downloaded files. Ghostscript should be installed now.

4. Set Environment variable GS_LIB:

ADDENVVAR ENVVAR(GS_LIB) VALUE('/QOpenSys/usr/local/bin:/QOpenSys/usr/local/share/ghostscript/8.54/lib:/QOpenSys/usr/local/share/ghostscript/8.54/Resource/fonts')

5. To change a PDF file to a PCL file:

CALL QP2SHELL2 PARM('/QOpenSys/usr/local/bin/gs' '-dQUIET' '-dBATCH' '-dNOPAUSE' '-sDEVICE=ljet4' '-sOutputFile=/IFS-Directory/pcl-ile.pcl' '/IFS-Directory/pdf-file.pdf')

6. Create a PRTF on the iseries with devietype *USERASCII

CRTPRTF FILE(PDFPRINT) DEVTYPE(*USERASCII)

7. FTP PCL file created in step 5 to the PRTF file created in step 6


Note 1: All commands and URL's should be on one and the same line when you execute them

Note 2: Step 5 can be automated an lot more if you locate the file pdf2ps in the ghostscript diretory, and adapt it to your needs, ie. Pdf2pcl. I've got:

#!/bin/bash
gs -sDEVICE=ljet4 -sOutputFile=$1.pcl -q -dBATCH -sPAPERSIZE=a4 -dNOPAUSE $1.pdf

after which you can convert a pdf file using the command "pdf2pcl pdf-File.pdf pcf-file.pcl"


This works fine at the moment. Hoewever, as Scott kindly suggested, steps 6 and 7 can easily be replaced by using the Qshell "rfile" command. Just haven't had time yet to try out that part, but I'm sure going tot do that, as the FTP solution isn't exactly elegant..

Greetings, Jack



-----Oorspronkelijk bericht-----
Van: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Namens Mike Krebs
Verzonden: donderdag 12 maart 2009 20:24
Aan: 'HTTPAPI and FTPAPI Projects'
Onderwerp: RE: Using FTPAPI to ftp to a printerfile

Jack,

Been looking for the this solution for a while. Could you elaborate on the
ghostscript install and conversion process? We can take this thread off-line
or maybe move to a midrange list.

Thanks,
Mike Krebs


> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
> bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Lammerts, Jack
> Sent: Thursday, March 12, 2009 11:10 AM
> To: HTTPAPI and FTPAPI Projects
> Subject: RE: Using FTPAPI to ftp to a printerfile
> 
> Hi Magne,
> 
> 
> 
> That was it!  Thank you very very much!
> 
> 
> 
> I was using the from and to filenames in a wrong order, just switched
> them to remote and then local file, and it works fine!
> 
> 
> 
> A definite case of a layer 8 probklem I guess, I was so focused on the
> fact that it might be a problem in Scott's procedures that I didn't see
> this very stupid error. Anyway, thanks for al your help guys!
> 
> 
> 
> And oh, by the way, the PCL file which I am uploading to the
> printerfile _is_ a PDF file, converted via PASE and ghostscript form
> PDF to PCL, which all printers are capable of printing.
> 
> 
> 
> Greetings, Jack
> 
> 
> 
> ________________________________
> 
> Van: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
> bounces@xxxxxxxxxxxxxxxxxxxxxx] Namens Magne Kofoed
> Verzonden: donderdag 12 maart 2009 16:27
> Aan: HTTPAPI and FTPAPI Projects
> Onderwerp: SV: Using FTPAPI to ftp to a printerfile
> 
> 
> 
> Hi,
> 
> 
> 
> for your info....this will also work with a pdf file....if your printer
> can recognize the pdf file printer stream.
> 
> 
> 
> Try using remote file: local file:          not  local file: remote
> file
> 
> 
> 
> if        ftp_put(sess: to: from) < 0
> 
> 
> 
> This i how it looks like in the FTPAPI_H source mbr.
> 
> 
> 
> D FTP_put         PR            10I 0
> D   peSocket                    10I 0 value
> D   peRemote                   256A   const
> D   peLocal                    256A   const options(*nopass)
> 
> 
> 
> 
> 
> Best regards
> 
> Magne
> 
> 
> 
> 
> ________________________________
> 
> Fra: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx på vegne av Mike Krebs
> Sendt: to 12.03.2009 14:13
> Til: 'HTTPAPI and FTPAPI Projects'
> Emne: RE: Using FTPAPI to ftp to a printerfile
> 
> Jack,
> 
> I see where you are headed here. Cool idea. What are the relevant
> parameters
> on the print file? Simply userascii?
> 
> CRTPRTF FILE(QGPL/FTPPRINT) DEVTYPE(*USERASCII)
> 
> Mike Krebs
> 
> 
> > -----Original Message-----
> > From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
> > bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Lammerts, Jack
> > Sent: Thursday, March 12, 2009 4:26 AM
> > To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: Using FTPAPI to ftp to a printerfile
> >
> > Hi Scott,
> >
> >
> >
> > Sorry, should have included the relevant code in the first place.
> >
> >
> >
> > This is the test code I use, shamelessly copied and adapted from one
> of
> > your
> >
> > supplied testprograms:
> >
> >
> >
> > * put the IFS PCL printerfile to a *USERASCII printerfile
> >
> >
> >
> > c                   eval      from = '/tmp/test.pcl'
> >
> > c                   eval      to   =
> '/qsys.lib/qgpl.lib/ftpprint.file'
> >
> >
> >
> > c                   callp     FTP_NamFmt(sess: 1)
> >
> > c                   callp     ftp_binaryMode(sess: *on)
> >
> >
> >
> > c                   if        ftp_put(sess: from: to) < 0
> >
> > c                   eval      Msg = ftp_errorMsg(sess)
> >
> > c                   dsply                   Msg
> >
> > c                   endif
> >
> >
> >
> > The error ocuurs at the ftp_put operation.
> >
> >
> >
> > Thnx in advance, Jack
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> --
> > -
> > -------------------
> >
> > Hi Jack,
> >
> >
> >
> > Please tell us how to create the same error for ourselves.  That will
> > help us to understand.
> >
> >
> >
> >
> >
> > Lammerts, Jack wrote:
> >
> > >
> >
> > >    I;ve been using your excellent project FTPAPI for some time now,
> > and I
> >
> > >    am liking it very much. Thanks!
> >
> > >
> >
> > >
> >
> > >    Today I've come across a situation which I don't know how to
> > solve.
> > I
> >
> > >    am trying to ftp a binary file from the IFS to a *USERASCII
> >
> > >    printerfile on our iSeries box. Manually FTP'ing the file to the
> >
> > >    printerfile works fine, but when I use FTPAPI I receive the
> error
> >
> > >    message "Invalid file type for FTP transfer". Are printerfiles
> not
> >
> > >    supported by your API, or am I doing something wrong?
> 
> 
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------