2016-11-10 4 views
10

최근 brother QL-700 프린터를 구입했으며이 컴퓨터를 통해 일부 스티커 인쇄를하고 있습니다.올바른 크기의 인쇄를 지정할 수 없습니다.

우리가 먹는 종이는 길이 제한이없는 62mm-wide sticker roll입니다.

문제는 아무리해도 (Book, PrintRequestAttributeSet) 시도했지만 Java를 사용하여 프린터 대화 상자 창에 프린터의 올바른 용지 크기를 사용하도록 알리지 못했습니다. 나는 그것을 할 수 없었다, 예를 들면 정확한 62mm × 40mm 우리가 필요로했다.

PrinterJob job = PrinterJob.getPrinterJob(); 
PageFormat pf = job.defaultPage(); 
Paper p = pf.getPaper(); 
p.setSize(UnitConv.mm2pt(62), UnitConv.mm2pt(40)); 
p.setImageableArea(0, 0, UnitConv.mm2pt(62), UnitConv.mm2pt(40)); 
pf.setPaper(p); 
pf.setOrientation(PageFormat.LANDSCAPE); 

job.setPrintable(this, pf); 

if (job.printDialog()) { 
    try { 
     job.print(); 
    } catch (Exception PrintException) { 
     PrintException.printStackTrace(); 
    } 
} 



내가 프린터가 길이에 인쇄 할 수 있음을 확인할 수 있습니다

여기

문제의 코드입니다 : 그것은이 원하는대로 항상 가장 가까운 종이에 "스냅" 아래의 스크린 샷 (Brother의 P-touch 편집기 사용)에 표시된 것처럼 공지 사항이 조정 비록하지만 36mm는 소프트웨어 자체가 미리 설정 한 :

그래서 질문 :

어떻게 정확한 40mm가 될 수있는 "length"종이의 강제로?

관련 :

17 mm x 54 mm: width = 0.67; height = 2.12 
17 mm x 87 mm: width = 0.67; height = 3.42 
23 mm x 23 mm: width = 0.9066535; height = 0.9066535 
iso-b10: width = 1.2204725; height = 1.7322835 
29 mm x 90 mm: width = 1.14; height = 3.5366535 
38 mm x 90 mm: width = 1.4966536; height = 3.5366535 
39 mm x 48 mm: width = 1.5366535; height = 1.8833464 
52 mm x 29 mm: width = 1.1366535; height = 2.0466535 
iso-b8: width = 2.440945; height = 3.464567 
62 mm x 29 mm: width = 1.1366535; height = 2.44 
62 mm x 100 mm: width = 2.44; height = 3.93 
12 mm Dia: width = 0.47334644; height = 0.47334644 
23 mm x 23 mm: width = 0.9066535; height = 0.9066535 
58 mm Dia: width = 2.2933464; height = 2.2933464 
12 mm: width = 0.47334644; height = 3.9366536 
29 mm: width = 1.14; height = 3.9366536 
38 mm: width = 1.4966536; height = 3.9366536 
50 mm: width = 1.9666536; height = 3.9366536 
54 mm: width = 2.1266534; height = 3.9366536 
62 mm x 100 mm: width = 2.44; height = 3.93 
12 mm x2: width = 0.82665354; height = 3.9366536 
54 mm: width = 2.1266534; height = 3.9366536 
38 mm x2: width = 2.8733466; height = 3.9366536 
50 mm x2: width = 3.8133464; height = 3.9366536 
54 mm x2: width = 3.9366536; height = 4.0933466 
62 mm x2: width = 3.9366536; height = 4.76 
29 mm: width = 1.14; height = 3.9366536 
29 mm x3: width = 3.18; height = 3.9366536 
38 mm x3: width = 3.9366536; height = 4.25 
50 mm x3: width = 3.9366536; height = 5.66 
54 mm x3: width = 3.9366536; height = 6.06 
62 mm x3: width = 3.9366536; height = 7.08 
38 mm: width = 1.4966536; height = 3.9366536 
29 mm x4: width = 3.9366536; height = 4.2 
38 mm x4: width = 3.9366536; height = 5.6266537 
50 mm x4: width = 3.9366536; height = 7.5066533 
54 mm x4: width = 3.9366536; height = 8.026653 
62 mm x4: width = 3.9366536; height = 9.4 
29 mm x 90 mm: width = 1.14; height = 3.5366535 
38 mm x 90 mm: width = 1.4966536; height = 3.5366535 
Small Address Label: width = 1.1366535; height = 2.44 
17 mm x 54 mm: width = 0.67; height = 2.12 
62 mm x 100 mm: width = 2.44; height = 3.93 
62 mm x 100 mm: width = 2.44; height = 3.93 
17 mm x 87 mm: width = 0.67; height = 3.42 
17 mm x 54 mm: width = 0.67; height = 2.12 
Binder 3 cm - Spine: width = 1.14; height = 8.226653 
Binder 5 cm - Spine: width = 2.44; height = 8.226653 
58 mm Dia: width = 2.2933464; height = 2.2933464 
12 mm Dia: width = 0.47334644; height = 0.47334644 
23 mm x 23 mm: width = 0.9066535; height = 0.9066535 
23 mm x 23 mm: width = 0.9066535; height = 0.9066535 
62 mm x 184 mm Postage Label: width = 2.44; height = 7.24 
Binder 5 cm - Spine: width = 2.44; height = 8.226653 

편집 (: custom paper size for labelprinter (Brother QL 570)

편집 나는 용지 크기 쿼리 (code)을했고, 여기가 지원할 수있는 미디어의 목록입니다

2017 년 4 월)

이 질문의 상태를 업데이트하기 만하면됩니다. 결국 나는 파이썬과 오픈 소스 유틸리티 brother_ql을 사용하여 동생이 제공 한 펌웨어를 사용하지 않고도 usb 포트로 작업을 직접 보냈다. 그것은 완벽하게 잘 작동하고 내 문제를 해결.

답변

1

높이와 길이와 폭을 혼동하지 마십시오 또한 다음 here

같은 답변을 더 좋은 방법이 없다, 자바의 용지 클래스는 폭과 높이되지 길이 당신도 할 수 있습니다

public void setSize(double width, double height) { 
    mWidth = width; 
    mHeight = height; 

소요 이것을 고려하기 위해

/** 
* Sets the imageable area of this <code>Paper</code>. The 
* imageable area is the area on the page in which printing 
* occurs. 
* @param x the X coordinate to which to set the 
* upper-left corner of the imageable area of this <code>Paper</code> 
* @param y the Y coordinate to which to set the 
* upper-left corner of the imageable area of this <code>Paper</code> 
* @param width the value to which to set the width of the 
* imageable area of this <code>Paper</code> 
* @param height the value to which to set the height of the 
* imageable area of this <code>Paper</code> 
*/ 
public void setImageableArea(double x, double y, 
          double width, double height) { 
    mImageableArea = new Rectangle2D.Double(x, y, width,height); 
} 

이들은 종이 수업 시간 동안의 방법 중 일부일 뿐이므로 임 플란셜 더 많은 매개 변수 .. 그래서 도와주세요 :)

+1

감사합니다. 프린터의 문제는 설정 한 크기에 상관없이 프린터 서비스가 항상 가장 가까운 크기로 "스냅"되어있는 것처럼 보입니다. 프린터는 62mm x * mm 크기의 용지를 인쇄 할 수 있기 때문에 프린터가 좋지 않습니다. . 그들이 제공 한 소프트웨어는 그것이 할 수 있다는 것을 증명했지만 자바에서는 그렇지 못했습니다. 어떻게 든 올바른 조합을 얻지 못하거나 Java 서비스가이를 지원하지 않습니다. –

0

나는 많은 시간을 보았습니다 PapersetSize 매개 변수가 전달되는 매개 변수는 픽셀 크기입니다.을 mm2px과 같이 변경하려고 할 수 있습니까? printjob request를 제출하면서

PrinterJob job = PrinterJob.getPrinterJob(); 
PageFormat pf = job.defaultPage(); 
Paper p = pf.getPaper(); 
int resolution = 72; // dpi 
p.setSize(UnitConv.mm2px(62, resolution), UnitConv.mm2px(40, resolution)); 
p.setImageableArea(0, 0, UnitConv.mm2px(62, resolution), UnitConv.mm2px(40, resolution)); 
pf.setPaper(p); 
pf.setOrientation(PageFormat.LANDSCAPE); 

job.setPrintable(this, pf); 

if (job.printDialog()) { 
    try { 
     job.print(); 
    } catch (Exception PrintException) { 
     PrintException.printStackTrace(); 
    } 
} 
+0

행운이 없습니다. 가장 가까운 변형 인 "58 mm Dia"를 선택합니다. –

0

당신은 PrintRequestAttribute을 사용해야 할 수도 있습니다. 사용자 정의 인쇄 용지 크기가 작동하지 않으면 발견 된 용지 크기를 query code을 사용하여 사용하고 요청 속성 집합에 가장 적합한 것을 선택하는 것이 좋습니다.

@Test 
public void testMyPrinteService() { 
    // select default or specific one here 
    PrintService printService = PrintServiceLookup.lookupDefaultPrintService(); 

    PrinterJob job = PrinterJob.getPrinterJob(); 

    PageFormat pf = job.defaultPage(); 
    Paper p = pf.getPaper(); 
    p.setSize(UnitConv.mm2pt(62), UnitConv.mm2pt(40)); 
    p.setImageableArea(0, 0, UnitConv.mm2pt(62), UnitConv.mm2pt(40)); 
    pf.setPaper(p); 
    pf.setOrientation(PageFormat.LANDSCAPE); 

    Printable myPrintable = null ;//some printable new MyPrintable(1); 
    PrintRequestAttributeSet printReqAttrs = new HashPrintRequestAttributeSet(); 
    PrintRequestAttribute jobPrinArea = new MediaPrintableArea(0, 0, 64, 40, MediaPrintableArea.MM); 
    printReqAttrs.add(jobPrinArea); 

    if (job.printDialog(printReqAttrs)) { 
     try { 
      job.setPrintable(myPrintable, pf); 
      job.setPrintService(printService); 
      //pass specific attributes to printer 
      job.print(printReqAttrs); 
     } catch (Exception PrintException) { 
      PrintException.printStackTrace(); 
     } 
    } 
} 

희망이 있습니다.

+0

이렇게하면 Java의 기본 프롬프트가 표시되지만 프린터가 작업을 거부하고 즉시 취소합니다. 나는이 방법을 사용하여 인쇄 할 수 없다 :(http://imgur.com/Hj77T7H –