java-print

Cannot specify the correct size for printing

梦想与她 提交于 2020-05-14 14:51:05
问题 We have acquired a brother QL-700 printer recently and we are doing some sticker printing through this machine. The paper that we have been feeding is a 62mm-wide sticker roll without "length" restriction. The issue is, no matter how I do (I've tried Book , PrintRequestAttributeSet ), I couldn't use Java to tells the printer dialog window to use the correct paper size for the printer. I couldn't make it, for example, exact 62mm × 40mm as we needed. It always "snap" to a nearest paper as it

Endorsement Epson TM-h6000IV Java Printing

柔情痞子 提交于 2020-01-17 04:41:07
问题 I need to print to an Epson Endorsement TM-h6000iv printer (usb version) with Java. However, I read the manual without hope to find sth can help. I change in printer preferences without hope also! I try with this code of java which TextPrinter class in java for printing work. Main "Print" function: // ----- start printing ------ public int print(Graphics g, PageFormat pf, int pageIndex) { double ww, hh, x, y; String s; pf = PF; // The PF indicates for defaultPage PF= Pj.defaultPage(); GG =

Endorsement Epson TM-h6000IV Java Printing

僤鯓⒐⒋嵵緔 提交于 2020-01-17 04:41:05
问题 I need to print to an Epson Endorsement TM-h6000iv printer (usb version) with Java. However, I read the manual without hope to find sth can help. I change in printer preferences without hope also! I try with this code of java which TextPrinter class in java for printing work. Main "Print" function: // ----- start printing ------ public int print(Graphics g, PageFormat pf, int pageIndex) { double ww, hh, x, y; String s; pf = PF; // The PF indicates for defaultPage PF= Pj.defaultPage(); GG =

How to print HTML and not the code using Java Print API?

十年热恋 提交于 2019-12-12 06:10:47
问题 I want to print an HTML file on user-defined printer without showing print dialog. Below is the code I run, but it prints the HTML code and not the actual page that is displayed in IE. import java.io.File; import java.net.MalformedURLException; import java.net.URL; import javax.print.DocFlavor; import javax.print.DocPrintJob; import javax.print.PrintException; import javax.print.PrintService; import javax.print.PrintServiceLookup; import javax.print.SimpleDoc; import javax.print.attribute

Print a PDF file using PrinterJob in Java

丶灬走出姿态 提交于 2019-11-27 07:52:59
I have an issue when trying to print a PDF file using Java. Here is my code: PdfReader readFtp = new PdfReader(); // This class is used for reading a PDF file PDDocument document = readFtp.readFTPFile(documentID); printRequestAttributeSet.add(new PageRanges(1, 10)); job.setPageable(document); job.print(printRequestAttributeSet); // calling for print document.close() I use document.silentPrint(job); and job.print(printRequestAttributeSet); - it works fine. If I use document.silentPrint(job); - I can't set the PrintRequestAttributeSet . Can anyone tell me how to set the PrintRequestAttributeSet

Print a PDF file using PrinterJob in Java

徘徊边缘 提交于 2019-11-26 13:52:00
问题 I have an issue when trying to print a PDF file using Java. Here is my code: PdfReader readFtp = new PdfReader(); // This class is used for reading a PDF file PDDocument document = readFtp.readFTPFile(documentID); printRequestAttributeSet.add(new PageRanges(1, 10)); job.setPageable(document); job.print(printRequestAttributeSet); // calling for print document.close() I use document.silentPrint(job); and job.print(printRequestAttributeSet); - it works fine. If I use document.silentPrint(job); -