hold jobs by default (Cups conf or Java)

Tarik Benabid anonymous at easysw.com
Wed Jul 28 04:03:32 PDT 2004


thanks Pieter, I'll try your method

T.B

pieterjandeboeck wrote:
>
> Sorry: forgot to mention: reset the cupsd after changes to the cupsd.conf file. (don't forget to set ownership back to "system" and group to "lp" after you made changes)
>
> you can reset the cupsd by rebooting. or there s a command in the terminal. (forgot sorry)
>
> once done make sure it's running again by typing cupsd and lpstat -t
>
>
> >> IMPORTANT: you MUST make changes to cupsd.conf through the terminal. Eg using the command "vi" using a texteditor of any kind. (in my experience) currupts the file and scheduler cannot startup.
>
> That took me a while to figure out also.
>
> Good luck
> Pieter-Jan
>
>
>
>
>
>
>
> pieterjandeboeck wrote:
> > Hey Tarik
> >
> > Yes, i ve been on that for a while, let me help you speed things up.
> > Assuming you can insert objective-c code in your Java (???) Otherwise there must be equivalent source code out there.
> >
> > > download the cups source code for your OS. place the folder somewhere relevant to your development. You can find this folder here:
> >
> > http://cups.org/software.php
> >
> > Alternatively, since cups is already running on your system. The files are located at location: /etc/cups . This is a root level directory. don't know about the other operating systems but on OSX it is hidden. (you cannot "search" for it.) On OS X you can open the finder and Press #G to goto a particular directory directly. There must be an equivalent on all systems.
> >
> >
> > Include all the header files in /cups-58 and /cups-58/cups . On other operating systems this is most likely another number
> >
> >     #import "cups-58/config.h"
> >     #import "cups-58/cups/cups.h"
> >     //#import "cups-58/cups/cups_C.h"
> >     #import "cups-58/cups/debug.h"
> >     #import "cups-58/cups/http.h"
> >     #import "cups-58/cups/http-private.h"
> >     #import "cups-58/cups/ipp.h"
> >     #import "cups-58/cups/language.h"
> >     #import "cups-58/cups/md5.h"
> >     #import "cups-58/cups/ppd.h"
> >     #import "cups-58/cups/string.h"
> >
> > (In c++ that's probably #include <""> instead)
> >
> >
> > Once you get that running, create a method with this code in it:
> >
> >
> > 	* Build an IPP_HOLD_JOB request, which requires the following
> > 	* attributes:
> > 	*
> > 	*    attributes-charset
> > 	*    attributes-natural-language
> > 	*    job-uri
> > 	*    requesting-user-name
> > 	*/
> >
> > request = ippNew();
> >
> > request->request.op.operation_id = IPP_HOLD_JOB;
> > request->request.op.request_id   = 1;
> >
> > language = cupsLangDefault();
> >
> > ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
> >         	     "attributes-charset", NULL,
> > cupsLangEncoding(language));
> >
> > ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
> >         	     "attributes-natural-language", NULL, language->language);
> >
> > slprintf(uri, sizeof(uri) - 1, "ipp://localhost/jobs/%d", pjob->sysjob);
> >
> > ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
> >
> > ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
> >         	     NULL, pjob->user);
> >
> >        /*
> > 	* Do the request and get back a response...
> > 	*/
> >
> >         ret = 1;
> >
> > 	if ((response = cupsDoRequest(http, request, "/jobs")) != NULL)
> > 	{
> > 	  if (response->request.status.status_code >= IPP_OK_CONFLICT)
> > 		DEBUG(0,("Unable to hold job %d - %s\n", pjob->sysjob,
> > 			 ippErrorString(cupsLastError())));
> >           else
> > 	  	ret = 0;
> >
> > 	  ippDelete(response);
> > 	}
> >
> > replace:
> > pjob->sysjob with the job ID to be replaced. (integer number)
> >      ->user  is the user of this request: you could get that with the method: -cupsUser();
> >
> >
> > lastly: you ll get error messages: in /etc/cups/cupsd.conf
> > set the
> >
> > LogLevel Info
> >
> > to
> >
> > LogLevel Debug2
> >
> > for full logging, so you can see exactly what the error was. you can look up these IPP error constant meanings on the internet.
> >
> >
> > If I got anything wrong, im sure michael will correct me :) Sorry i couldn't give you java specific code.
> >
> > Pieter-Jan
> >
> >
> >
> >
> >
> > Tarik Benabid wrote:
> > > Hi,
> > >
> > > I'm developping a java application, and I have to check jobs, make some works and after allow printing or not.
> > >
> > > outside the solution of backend.
> > >
> > > * are there any Cups configuration, to hold jobs by default.
> > > * how can I use HOLD_NEW_JOBS in cups/scripting/java/.../IPPDefs.java
> >
>





More information about the cups-devel mailing list