JAVA에서 인쇄가 잘 안 될때... "No print service found" 혹은 "인쇄 서비스를 찾을 수 없습니다"가 뜰 때

hayarobi의 이미지

저처럼 몇 달간 인쇄도 못 쓰는 상황을 막기 위해 씁니다.

자바 기반 프로그램, 혹은 자바에서 인쇄를 하려는데 아래와 같은 메시지를 내보내며 프린터를 못 찾는 분들이 있을 것입니다.

No print service found .
인쇄 서비스를 찾을 수 없습니다.

제가 리눅스를 설치하고 석 달간 인쇄를 못 하고 있었습니다. 언어 설정에 따라 오류 메시지가 영어로 나오기도 했고 한글로 나오기도 했죠. 한동안 해결책을 찾아다니다 실패해서 손 놓고 있다가 오늘 다시 뒤져 해결방법을 찾았습니다.

프리마인드 제작자와 문서 작성자에게 감사를 해야겠네요.
http://freemind.sourceforge.net/wiki/index.php/FreeMind_on_Linux#Why_do_I_get_a_.22No_print_service_found.22_whenever_I_attempt_to_print.3F

자바는 리눅스에서 cups를 이용해 출력을 지원합니다. 그래서 cups가 설치를 해야합니다. 문제는 cups가 설치를 했는데도 인쇄 서비스를 못 찾겠다며 버티는 경우입니다. 자바 1.5에서는 프린터 이름에 '-'가 들어가면 인식을 못 하는 버그가 있다는데 제 경우는 그것도 아니었습니다. 이 경우는 아래 방법 중 한 가지를 해 보시면 도움이 될 것입니다. 제 경우는 세번째가 효과가 있었습니다.

1. 프린터 이름에서 '-'를 뺀다. 예) "my-printer" 에서 "myprinter"로 변경
2. 네트웍 프린터: CUPS에서 네트웍 프린터를 '-'가 없는 간단한 이름으로 생성을 하고 CUPS URI값을 lpstat -v로 나온 이름으로 쓴다.
3. /usr/lib/libcups.so 파일을 조사해서 이것이 /usr/lib/libcups.so.2의 링크라면 /usr/lib/libcups.so 파일을 지운다.

아래 코드로 프린팅이 되는지를 검사할 수 있습니다.

import java.awt.print.PrinterJob;
 
class DummyPrinter {
   public static void main(String[] args) {
       try {
           PrinterJob printJob=PrinterJob.getPrinterJob();
           printJob.printDialog();
           System.exit(0);
       } catch( Exception e) {
           e.printStackTrace();
       }
   }
}
Forums: 

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.