Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java &引用;打印例外:纸张';s可成像宽度太小”;我能看到什么';这是错的,但我怎样才能解决它呢?_Java_Printing_Thermal Printer - Fatal编程技术网

Java &引用;打印例外:纸张';s可成像宽度太小”;我能看到什么';这是错的,但我怎样才能解决它呢?

Java &引用;打印例外:纸张';s可成像宽度太小”;我能看到什么';这是错的,但我怎样才能解决它呢?,java,printing,thermal-printer,Java,Printing,Thermal Printer,在我当前的大学项目中,当我尝试为特定的标签打印机打印某些内容时,出现以下错误: java.awt.print.PrinterException: Paper's imageable width is too small. at sun.print.RasterPrinterJob.printPage(Unknown Source) at sun.print.RasterPrinterJob.print(Unknown Source) at sun.print.Raster

在我当前的大学项目中,当我尝试为特定的标签打印机打印某些内容时,出现以下错误:

java.awt.print.PrinterException: Paper's imageable width is too small.
    at sun.print.RasterPrinterJob.printPage(Unknown Source)
    at sun.print.RasterPrinterJob.print(Unknown Source)
    at sun.print.RasterPrinterJob.print(Unknown Source)
    at Printer.print(Printer.java:91)
    at Printer.<init>(Printer.java:43)
    at VisitorDBTest.main(VisitorDBTest.java:10)
据我所知,PageFormat从纸张获取其可成像宽度,PrinterJob从PageFormat获取其可成像宽度。
很明显,我遗漏了一些东西

我对Dymo 420P也有同样的问题


尝试将可成像区域设置为与纸张和原点0,0相同的大小。然后在
PrinterJob.printDialog()
之后,使用页面格式调用
PrinterJob.validatePage()
。它将返回具有适当可成像区域的有效页面格式。

我对Dymo 420P也有同样的问题

尝试将可成像区域设置为与纸张和原点0,0相同的大小。然后在
PrinterJob.printDialog()
之后,使用页面格式调用
PrinterJob.validatePage()
。它将返回具有适当可成像区域的有效页面格式。

我解决它

    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

    aset.add(OrientationRequested.PORTRAIT);
    aset.add(MediaSizeName.INVOICE);


        job.print( aset);
我用加法解决它

    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

    aset.add(OrientationRequested.PORTRAIT);
    aset.add(MediaSizeName.INVOICE);


        job.print( aset);