LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2011, 06:13 AM   #1
surwassu
LQ Newbie
 
Registered: May 2011
Posts: 18

Rep: Reputation: Disabled
Error in printing a file


Hi Guys,
I am new to cups n trying to learn it by executing simple programs.I am trying to print a ps file through code using cupsPrintFile..The code is as follows:
Code:
#include <cups/cups.h>
#include<stdio.h>
int main()
{
int num_dests;
cups_dest_t *dests, *default_dest;
int job_id;
num_dests = cupsGetDests(&dests);
default_dest = cupsGetDest(NULL, NULL, num_dests, dests);
job_id = cupsPrintFile(default_dest->name, "/data/print.ps","my title",default_dest->num_options,default_dest->options);
//printf("\n\n\\t%d",job_id);
return 0;
}

Programs execute properly but didn't print the file .I checked error log file which is showing me following error.
[error]

E [15/Jun/2011:14:54:15 +0000] Unable to bind socket for address ::1:631 - Address already in use.
E [15/Jun/2011:14:54:15 +0000] Unable to bind socket for address 127.0.0.1:631 - Address already in use.
X [15/Jun/2011:14:54:15 +0000] No Listen or Port lines were found to allow access via localhost!
E [15/Jun/2011:15:14:17 +0000] [Job 71] Aborting job because it has no files.
E [15/Jun/2011:15:39:50 +0000] Unable to bind socket for address ::1:631 - Address already in use.
E [15/Jun/2011:15:39:50 +0000] Unable to bind socket for address 127.0.0.1:631 - Address already in use.
X [15/Jun/2011:15:39:50 +0000] No Listen or Port lines were found to allow access via localhost!
E [15/Jun/2011:15:39:59 +0000] Unable to bind socket for address ::1:631 - Address already in use.
E [15/Jun/2011:15:39:59 +0000] Unable to bind socket for address 127.0.0.1:631 - Address already in use.
X [15/Jun/2011:15:39:59 +0000] No Listen or Port lines were found to allow access via localhost!



[/error]



Can Anybody help me to solve this problem ?
Thanks
Regards,
Sumit
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-07-2011, 07:34 AM   #2
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Hi Sumit,
Try restarting your daemon.

Code:
service cups restart
Are you otherwise able to print files ?

Try these
Code:
# lpr filename (This will give you the default printer)
# lpr -P printer filename   (Now replace the printer name from the above command)
You might find this link useful.

Last edited by vikas027; 06-07-2011 at 07:36 AM.
 
2 members found this post helpful.
Old 06-08-2011, 01:28 AM   #3
surwassu
LQ Newbie
 
Registered: May 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by vikas027 View Post
Hi Sumit,
Try restarting your daemon.

Code:
service cups restart
Are you otherwise able to print files ?

Try these
Code:
# lpr filename (This will give you the default printer)
# lpr -P printer filename   (Now replace the printer name from the above command)
You might find this link useful.
hi,
Thanks buddy
The error was about connection problem with printer .I have solved it .Thanks for providing link but I want tot print the file through program not through command.

Do you have any idea about how to configure printer through cups API..?
Thanks
 
Old 06-10-2011, 04:34 PM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by surwassu View Post
hi,
Thanks buddy
The error was about connection problem with printer .I have solved it .Thanks for providing link but I want tot print the file through program not through command.

Do you have any idea about how to configure printer through cups API..?
Thanks
No, I am sorry.
 
Old 06-10-2011, 05:02 PM   #5
Hevithan
Member
 
Registered: Apr 2011
Location: Washington State
Distribution: Zorin5-(Ubuntu 11.04) // Backtrack 5-(Ubuntu 10.04) // Dreamlinux 3.5-(Debian)
Posts: 275
Blog Entries: 5

Rep: Reputation: 40
Isn't that just the code that Snark1994 gave you IN THIS POST on one of your other threads on this same subject?

Not to knitpick or anything, But I think if you where to post on that thread about how the code didn't properly work, You would get a more detailed reference as to why it isn't working.

I think that keeping one thread going on the same subject will yield better results, all errors can be seen and everyone will be able to assist you better, It's just more organized and you won't have to go through 4 threads all with multiple suggestions. starting a new thread for every step is just going to lead to confusion for you and confusion for others.

Of course that is just my opinion and I may be way off base mentioning it. Hope you get it figured out, Good luck.
 
Old 06-12-2011, 09:02 AM   #6
surwassu
LQ Newbie
 
Registered: May 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Hevithan View Post
Isn't that just the code that Snark1994 gave you IN THIS POST on one of your other threads on this same subject?

Not to knitpick or anything, But I think if you where to post on that thread about how the code didn't properly work, You would get a more detailed reference as to why it isn't working.

I think that keeping one thread going on the same subject will yield better results, all errors can be seen and everyone will be able to assist you better, It's just more organized and you won't have to go through 4 threads all with multiple suggestions. starting a new thread for every step is just going to lead to confusion for you and confusion for others.

Of course that is just my opinion and I may be way off base mentioning it. Hope you get it figured out, Good luck.
Hi buddy,
I have wanted to clear few things.
I have checked about snark's post but u can check the date when I have posted this error in printing file post.It is posted on 07-06-2011,then I created new post on 08-06-2011 for my new problem saying reading contents from pdf file .This post has nothing to do with my previous post but u can find sneak gives me same code for that problem as a solution. That code,which any one can find on WWW.cups.org.I haven't done this intentionally ,on next time on words I will take care of that it won't happen .
Thanks & regards,
Sumit
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS Large File Copies Fail - Error writing to file: Input/output error deck- Linux - Server 10 08-01-2022 02:30 AM
Searching .txt file for (specific) strings and printing them to new file Hb_Kai Linux - General 7 02-18-2010 09:09 AM
[SOLVED] Sometimes not getting entire file when printing to a file in SeaMonkey blackhole54 Linux - Software 2 08-06-2009 11:44 PM
Printing trouble (Error: client-error-not-possible) Viro Linux - Hardware 2 03-12-2005 02:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration