[cups.development] cupsPrintFile2 API returns -1 (v1.6.1)

Charles Woloszynski cwoloszynski at gmail.com
Fri Nov 9 05:57:43 PST 2012


Nevermind.  I found the error.  It was in my code and handling the return value. The server was reporting the right value.

Newbie problem.

Charlie


On Nov 8, 2012, at 10:33 PM, Charles Woloszynski <cwoloszynski at gmail.com> wrote:

> Here is the 'error_log' of the exchange.  
> 
> It looks like the job is created with a job number but I am not getting it back.  The CUPS daemon on OSX is the stock one and I am using the CUPS API installed on OSX.  Do you see anything that could explain why I am not getting a job back.
> 
> Thanks in advance,
> 
> Charlie
> 
> D [08/Nov/2012:22:28:42 -0500] Report: clients=2
> D [08/Nov/2012:22:28:42 -0500] Report: jobs=499
> D [08/Nov/2012:22:28:42 -0500] Report: jobs-active=0
> D [08/Nov/2012:22:28:42 -0500] Report: printers=5
> D [08/Nov/2012:22:28:42 -0500] Report: printers-implicit=0
> D [08/Nov/2012:22:28:42 -0500] Report: stringpool-string-count=12651
> D [08/Nov/2012:22:28:42 -0500] Report: stringpool-alloc-bytes=16840
> D [08/Nov/2012:22:28:42 -0500] Report: stringpool-total-bytes=240552
> D [08/Nov/2012:22:29:25 -0500] cupsdAcceptClient: 22 from 192.168.1.4:631 (IPv4)
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 22 POST /printers/Canon_MF4500_Series HTTP/1.1
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
> D [08/Nov/2012:22:29:25 -0500] cupsdAuthorize: No authentication data provided.
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 22 2.0 Create-Job 7
> D [08/Nov/2012:22:29:25 -0500] Create-Job ipp://localhost:631/printers/Canon_MF4500_Series
> D [08/Nov/2012:22:29:25 -0500] cupsdMarkDirty(----J-)
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients"
> D [08/Nov/2012:22:29:25 -0500] add_job: requesting-user-name="poweruser"
> D [08/Nov/2012:22:29:25 -0500] Adding default job-sheets values "none,none"...
> I [08/Nov/2012:22:29:25 -0500] [Job 1116] Adding start banner page "none".
> D [08/Nov/2012:22:29:25 -0500] Discarding unused job-created event...
> I [08/Nov/2012:22:29:25 -0500] [Job 1116] Queued on "Canon_MF4500_Series" by "poweruser".
> D [08/Nov/2012:22:29:25 -0500] Returning IPP successful-ok for Create-Job (ipp://localhost:631/printers/Canon_MF4500_Series) from 192.168.1.4
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdAcceptClient: 23 from localhost (Domain)
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 23 POST / HTTP/1.1
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdAuthorize: No authentication data provided.
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 23 1.1 Get-Jobs 1
> D [08/Nov/2012:22:29:25 -0500] Get-Jobs ipp://localhost:631/printers/Canon_MP460
> D [08/Nov/2012:22:29:25 -0500] Returning IPP successful-ok for Get-Jobs (ipp://localhost:631/printers/Canon_MP460) from localhost
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 23 WAITING Closing on EOF
> D [08/Nov/2012:22:29:25 -0500] cupsdCloseClient: 23
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Dirty files", busy="Dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 22 POST /printers/Canon_MF4500_Series HTTP/1.1
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdAuthorize: No authentication data provided.
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 22 2.0 Send-Document 8
> D [08/Nov/2012:22:29:25 -0500] Send-Document ipp://localhost:631/printers/Canon_MF4500_Series
> D [08/Nov/2012:22:29:25 -0500] cupsdIsAuthorized: requesting-user-name="poweruser"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] Auto-typing file...
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] Request file type is application/pdf.
> D [08/Nov/2012:22:29:25 -0500] cupsdMarkDirty(----J-)
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients and dirty files"
> I [08/Nov/2012:22:29:25 -0500] [Job 1116] File of type application/pdf queued by "poweruser".
> I [08/Nov/2012:22:29:25 -0500] [Job 1116] Adding end banner page "none".
> D [08/Nov/2012:22:29:25 -0500] cupsdMarkDirty(----J-)
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdMarkDirty(----J-)
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:25 -0500] Asserting dark wake.
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:25 -0500] Discarding unused printer-state-changed event...
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] job-sheets=none,none
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] argv[0]="Canon_MF4500_Series"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] argv[1]="1116"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] argv[2]="poweruser"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] argv[3]="title"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] argv[4]="1"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] argv[5]="job-uuid=urn:uuid:b359de79-2146-39a5-4fa8-65cafa85e915 job-originating-host-name=192.168.1.4 time-at-creation=1352431765 time-at-processing=1352431765"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] argv[6]="/private/var/spool/cups/d01116-001"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[0]="<CFProcessPath>"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[1]="CUPS_CACHEDIR=/private/var/spool/cups/cache"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[2]="CUPS_DATADIR=/usr/share/cups"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[3]="CUPS_DOCROOT=/usr/share/doc/cups"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[4]="CUPS_FONTPATH=/usr/share/cups/fonts"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[5]="CUPS_REQUESTROOT=/private/var/spool/cups"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[6]="CUPS_SERVERBIN=/usr/libexec/cups"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[7]="CUPS_SERVERROOT=/private/etc/cups"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[8]="CUPS_STATEDIR=/private/etc/cups"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[9]="HOME=/private/var/spool/cups/tmp"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[10]="PATH=/usr/libexec/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[11]="SERVER_ADMIN=root at office-imac.home"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[12]="SOFTWARE=CUPS/1.5.4"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[13]="TMPDIR=/private/var/spool/cups/tmp"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[14]="USER=root"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[15]="CUPS_MAX_MESSAGE=2047"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[16]="CUPS_SERVER=/private/var/run/cupsd"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[17]="CUPS_ENCRYPTION=IfRequested"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[18]="IPP_PORT=631"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[19]="CHARSET=utf-8"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[20]="LANG=en_US.UTF-8"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[21]="APPLE_LANGUAGE=en-US"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[22]="PPD=/private/etc/cups/ppd/Canon_MF4500_Series.ppd"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[23]="RIP_MAX_CACHE=128m"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[24]="CONTENT_TYPE=application/pdf"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[25]="DEVICE_URI=cntdbmu://USB/Canon_MF4500_Series/usb://Canon/MF4500%20Series?serial=0115G10FD494"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[26]="PRINTER_INFO=MF4570 Printer"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[27]="PRINTER_LOCATION=Office iMac"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[28]="PRINTER=Canon_MF4500_Series"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[29]="PRINTER_STATE_REASONS=none"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[30]="CUPS_FILETYPE=document"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[31]="FINAL_CONTENT_TYPE=printer/Canon_MF4500_Series"
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] envp[32]="AUTH_I****"
> I [08/Nov/2012:22:29:25 -0500] [Job 1116] Started filter /Library/Printers/Canon/UFR2/Cores/cupstomcdufr2/Contents/MacOS/cupstomcdufr2 (PID 2901)
> I [08/Nov/2012:22:29:25 -0500] [Job 1116] Started backend /usr/libexec/cups/backend/cntdbmu (PID 2902)
> D [08/Nov/2012:22:29:25 -0500] Discarding unused job-state-changed event...
> D [08/Nov/2012:22:29:25 -0500] Returning IPP successful-ok for Send-Document (ipp://localhost:631/printers/Canon_MF4500_Series) from 192.168.1.4
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdAcceptClient: 26 from localhost (Domain)
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 26 POST / HTTP/1.1
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Active clients, printing jobs, and dirty files", busy="Printing jobs and dirty files"
> D [08/Nov/2012:22:29:25 -0500] cupsdAuthorize: No authentication data provided.
> D [08/Nov/2012:22:29:25 -0500] cupsdReadClient: 26 1.1 Get-Jobs 1
> D [08/Nov/2012:22:29:25 -0500] Get-Jobs ipp://localhost/printers/Canon_MF4500_Series
> D [08/Nov/2012:22:29:25 -0500] Returning IPP successful-ok for Get-Jobs (ipp://localhost/printers/Canon_MF4500_Series) from localhost
> D [08/Nov/2012:22:29:25 -0500] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Active clients, printing jobs, and dirty files"
> E [08/Nov/2012:22:29:25 -0500] [Job 1116] 
> I [08/Nov/2012:22:29:25 -0500] [Job 1116] Processing Job
> D [08/Nov/2012:22:29:25 -0500] [Job 1116] Set job-printer-state-message to "Processing Job", current level=INFO
> D [08/Nov/2012:22:29:25 -0500] Discarding unused job-progress event...
> D [08/Nov/2012:22:29:25 -0500] Discarding unused printer-state-changed event...
> D [08/Nov/2012:22:29:26 -0500] cupsdReadClient: 26 WAITING Closing on EOF
> D [08/Nov/2012:22:29:26 -0500] cupsdCloseClient: 26
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
> D [08/Nov/2012:22:29:26 -0500] PID 2902 (/usr/libexec/cups/backend/cntdbmu) exited with no errors.
> D [08/Nov/2012:22:29:26 -0500] PID 2901 (/Library/Printers/Canon/UFR2/Cores/cupstomcdufr2/Contents/MacOS/cupstomcdufr2) exited with no errors.
> D [08/Nov/2012:22:29:26 -0500] Discarding unused job-completed event...
> I [08/Nov/2012:22:29:26 -0500] [Job 1116] Job completed.
> D [08/Nov/2012:22:29:26 -0500] cupsdMarkDirty(----J-)
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
> D [08/Nov/2012:22:29:26 -0500] Discarding unused printer-state-changed event...
> D [08/Nov/2012:22:29:26 -0500] cupsdReadClient: 25 POST / HTTP/1.1
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Printing jobs and dirty files"
> D [08/Nov/2012:22:29:26 -0500] Releasing dark wake assertion.
> D [08/Nov/2012:22:29:26 -0500] cupsdAuthorize: Authorized as "charlie" using AuthRef
> D [08/Nov/2012:22:29:26 -0500] cupsdReadClient: 24 POST /printers/Canon_MP460 HTTP/1.1
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:26 -0500] cupsdAuthorize: No authentication data provided.
> D [08/Nov/2012:22:29:26 -0500] cupsdReadClient: 24 1.1 Get-Printer-Attributes 1
> D [08/Nov/2012:22:29:26 -0500] Get-Printer-Attributes ipp://localhost/printers/Canon_MP460
> D [08/Nov/2012:22:29:26 -0500] Returning IPP successful-ok for Get-Printer-Attributes (ipp://localhost/printers/Canon_MP460) from localhost
> D [08/Nov/2012:22:29:26 -0500] cupsdReadClient: 25 1.1 Get-Printer-Attributes 1
> D [08/Nov/2012:22:29:26 -0500] Get-Printer-Attributes ipp://localhost:631/printers/Canon_MP460
> D [08/Nov/2012:22:29:26 -0500] Returning IPP successful-ok for Get-Printer-Attributes (ipp://localhost:631/printers/Canon_MP460) from localhost
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Dirty files", busy="Active clients and dirty files"
> D [08/Nov/2012:22:29:26 -0500] cupsdReadClient: 24 POST /printers/Canon_MP460 HTTP/1.1
> D [08/Nov/2012:22:29:26 -0500] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Dirty files"
> D [08/Nov/2012:22:29:26 -0500] cupsdAuthorize: No authentication data provided.
> 
> On Nov 8, 2012, at 9:17 AM, Michael Sweet <msweet at apple.com> wrote:
> 
>> Hmm, strange, the only way this function could return -1 is if the server returned it...
>> 
>> Can you provide a snippet of a debug error_log from the server? (run "cupsctl --debug-logging" on the server to enable debug logging...)
>> 
>> 
>> On 2012-11-08, at 7:10 AM, Charles Woloszynski <cwoloszynski at gmail.com> wrote:
>> 
>>> It came back 'successful-ok' in cupsLastErrorString()
>>> 
>>> 
>>> On Nov 8, 2012, at 7:06 AM, Michael Sweet <msweet at apple.com> wrote:
>>> 
>>>> Check the value of cupsLastError() and cupsLastErrorString().
>>>> 
>>>> On 2012-11-08, at 7:04 AM, Charles Woloszynski <cwoloszynski at gmail.com> wrote:
>>>> 
>>>>> I am new to using the CUPS API and I hope someone can help me.
>>>>> 
>>>>> I have a program that is submitting a PDF to CUPS for printing. Since the printer may be remote, I am using cupsPrintFile2 with the http parameter.
>>>>> 
>>>>> When I do this, I *always* get back a -1.  The job prints (yeah!) but I think I have something wrong since I don't think that I should always get back a -1 as the jobID.  
>>>>> 
>>>>> My call is really simple:
>>>>> 
>>>>> jobId = cupsPrintFile2(http, destination, jobName, "title", 0, NULL);
>>>>> 
>>>>> Any thoughts?  Did I need to include some job option to get back the jobID?
>>>>> 
>>>>> The remote CUPS server is running on OSX, if that matters.
>>>>> 
>>>>> Thanks in advance,
>>>>> 
>>>>> Charlie
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> cups-dev mailing list
>>>>> cups-dev at easysw.com
>>>>> http://lists.easysw.com/mailman/listinfo/cups-dev
>>>> 
>>>> __________________________________________________
>>>> Michael Sweet, Senior Printing System Engineer, PWG Chair
>>>> 
>>>> _______________________________________________
>>>> cups-dev mailing list
>>>> cups-dev at easysw.com
>>>> http://lists.easysw.com/mailman/listinfo/cups-dev
>>> 
>>> _______________________________________________
>>> cups-dev mailing list
>>> cups-dev at easysw.com
>>> http://lists.easysw.com/mailman/listinfo/cups-dev
>> 
>> __________________________________________________
>> Michael Sweet, Senior Printing System Engineer, PWG Chair
>> 
>> _______________________________________________
>> cups-dev mailing list
>> cups-dev at easysw.com
>> http://lists.easysw.com/mailman/listinfo/cups-dev
> 





More information about the cups-devel mailing list