Questions tagged [java-print]

45 questions
1
vote
2 answers

Java PrintJob to DocPrintJob Not Working?

I have a class that extends from Printable, it prints fine using the standard PrintJob, but i would like to move to DocPrintJob so i can listen to the status of the print (successful print etc). My current code looks like this to create a print job…
Gillardo
  • 9,518
  • 18
  • 73
  • 141
0
votes
0 answers

Package org.apache.pdfbox.printing does not exist while running a standalone java program

I am using Jdk-8 in my system and trying to run a standalone java program to validate printing in the printer. The full PrintTest class is mentioned below as: import java.io.*; import java.awt.print.PrinterJob; import java.io.FileInputStream; import…
Tom
  • 1
  • 1
0
votes
1 answer

Java program to print raw data in Windows fails

i have been stuck with this problem for a long time. I am trying to print a file in Windows sending its raw bytes to printer. Here is the code i am using PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); …
Mirai
  • 31
  • 1
  • 4
0
votes
1 answer

Printing ANSI color codes in java works on VS Code terminal but not in CMD?

I wanted to Print Colored Text in Java Console. I have Ran the following code in VSCode and it Runs fine and its not working in CMD. The java Code: ` // Java Program to Print Colored Text in Console // Importing input output classes import…
Annas
  • 11
0
votes
0 answers

Java print api ZPL support

Is it possible to print using zpl through java print api? In my print application i usually send pdf contents for printing to the printers. I want the support for printing using zpl. Is it possible to pass the zpl in the print api for printing?
0
votes
0 answers

How to access printers configured on windows-print-server using java?

I have one windows-print-server(ip 192.168.2.1) configured with all the printers in my network. I have a java(spring boot) application which runs on another windows box(ip 192.168.2.2) in the same network. Need to add printing capabilities in the…
SD Shaw
  • 181
  • 1
  • 1
  • 9
0
votes
0 answers

JAVA - Getting path of last printed file

I create a method that print a jTable & methode printTable() save a file as pdf, I Want to get the path of saved file.pdf there is my part of code : public static void printTable() { MessageFormat Header = new MessageFormat("Password…
Kamal Fach
  • 79
  • 6
0
votes
1 answer

Wrong iteration while printing a multiple page(Possibly printer or PDF) document using Java Printing API

I am using Java Printing API and have got the code of printing multiple page document of billing invoice from this oracle page. Printing a Multiple Page Document And Example code from this page PaginationExample Now as you know most invoice have…
0
votes
0 answers

Setting resolution for printing PDFs with JAVA and apache.pdfbox

I used this example to write a program for PDF printing. But I found out, that java standard print for images is set to 72 DPI. So I searched further and added attributes for changing the resolution. But it does not work, it is still 72 DPI. The…
Namal
  • 281
  • 2
  • 10
0
votes
1 answer

How to print PDF with cropped printer's hard margins instead of shift?

I'm trying to print PDF on special type of paper, where content's position matter, and shift is not allowed. I'm using java.awt.print.PrinterJob and org.apache.pdfbox.printing.PDFPrintable: public void printPDF(byte[] pdf) throws IOException,…
kravemir
  • 10,636
  • 17
  • 64
  • 111
0
votes
2 answers

How to stop null from printing

When executing my program it keeps displaying "null" on line 13 I want to know what's wrong on my algorithm for it keeps printing null. private class SpadeIterator implements Iterator{ private int nextCardSpade; private List
user9048375
0
votes
0 answers

Why is this Java Page Printing code so extraordinarily slow and is there any alternative to it?

I am using Printable interface. The exact code for PrintPanel which implements Printable is: package accessory; // all necessary imports public class PrintPanel implements Printable { BufferedImage printableImages[] = null; DynPanel printable =…
Swapnil B
  • 79
  • 1
  • 8
0
votes
2 answers

Java print API send commands to printer

I have got some printers well installed on my computer (Windows 7) and well displayed on the control panel. I would like to send some special commands like: cut command, or barcode printing commands (ESC/POS commands). Is it possible to do that…
Mssm
  • 717
  • 11
  • 29
0
votes
2 answers

Printing ByteArrayOutputStream object

I have a generated PDF document using iText library, then I kept the document in memory using a ByteArrayOutputStream to print it but it's not printing anything. Any idea on why isn't it printing? You can find the code below and thanks in advance. …
0
votes
0 answers

Printing a PDF document using java without FileInputStream

I have a generated document using iText library in java using the next code: Document document = new Document(); document.open(); I manipulate the document with adding tables and data to it. Now i want to print the document after…