[Samba] printing to network postscript printer gives ascii output of postscript job

Andy Crichton andy.crichton at abibuildingdata.com
Thu Mar 21 09:25:02 GMT 2002


Thanks all - it was a win32 driver adding stuff before the postscript header
the machine didn't have perl so the following worked for me:

#include <stdio.h>
#include <string.h>
#include <errno.h>

static void bail (char *msg){
        perror (msg);
        exit(errno);
}

int main(int argc,char**argv)
{
        char buf[5*1024];
        char *job_starts;

        if (!fgets(buf,sizeof(buf)-1,stdin)){
                bail("Failed to read initial buffer");
        }

        job_starts=strstr(buf,"%!PS");
        while (!job_starts){
                if (!fgets(buf,sizeof(buf)-1,stdin)){
                        bail("Failed to find start of job");
                }
                job_starts=strstr(buf,"%!PS");
        }

        /*output everything from job_starts onwards */
        fputs(job_starts,stdout);

        /* rest of stdin to stdout */
        while (fgets(buf,sizeof(buf)-1,stdin)){
                fputs(buf,stdout);
        }

        exit(0);
}



This was inserted the usual way -
A useful reference on solaris printing is here which explains filters
http://soldc.sun.com/articles/basicprinting.html

An alternative solution is to use a win32 postscript driver which doesn't
add stuff to the front
of the job.

-----Original Message-----
From: herb at chomps.engr.sgi.com [mailto:herb at chomps.engr.sgi.com]On
Behalf Of Herb Lewis
Sent: Wednesday, March 20, 2002 06:32
To: Andy Crichton
Cc: samba at lists.samba.org
Subject: Re: [Samba] printing to network postscript printer gives ascii
output of postscript job


Andy Crichton wrote:
>
> solaris 7 with samba 2.0.7
>
> I already have several network printers on the box which work fine
(although
> I didn't set them up)
> I used the following commands to configure the printer under solaris
> lpadmin -p NAME_OF_PRINTER -o protocol=bsd,dest=IP_ADDR -v /dev/null -m
> netstandard -T PS _I postscript
> enable NAME_OF_PRINTER
> accept NAME_OF_PRINTER
>
> if I print using lp it works fine however I installed the postscript
printer
> drivers for the machine on a win98 box and printed through samba, the
output
> consisted of the postscript source in ascii. The only entry in the
smb.conf
> mentioning printing is
> [printers]
>         comment = All Printers
>         path = /var/spool/samba
>         guest ok = Yes
>         printable = Yes
>         browseable = No
>
> Thanks for any ideas
> Andy Crichton
>
> p.s. the printer is a danka 4220 MF but I presume this isn't the cause.
>

I don't know about that particular driver but some drivers send some
non-postscript commands at the beginning of the file that confuse the
printing system into thinking it is a text file. Take a look at the
script packaging/SGI/sambalp in the samba source directory for an
example of how to fix this. You will have to change the lpcommand
variable and other paths if you are not using SYSV printing. The
important stuff is in the "if ($PSFIX)" section.
--
======================================================================
Herb Lewis                               Silicon Graphics
Networking Engineer                      1600 Amphitheatre Pkwy MS-510
Strategic Software Organization          Mountain View, CA  94043-1351
herb at sgi.com                             Tel: 650-933-2177
http://www.sgi.com                       Fax: 650-932-2177
======================================================================

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


__________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. The contents are confidential and may be privileged.
Any views or opinions expressed are those of the sender and may not reflect the views or opinions of the company and the company accepts no liability in respect thereof.
If you have received this email in error please notify postmaster at abibuildingdata.com immediately.

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________




More information about the samba mailing list