Abhishek
Abhishek

Reputation: 1

How to set printing document name in java

I am printing 4 copies of a document. Each copy has only a single line change. While saving it through "microsoft print to PDF", I am getting dialogue box to set location path and has default name of document as "java printing". How can I programmatically change name of the document?

I have read about the DocumentName attribute class, but I don't know how to use it with a printerJob object.

Please help with an example.

Upvotes: 0

Views: 844

Answers (1)

kucu
kucu

Reputation: 41

Please try this:

PrinterJob job = PrinterJob.getPrinterJob();
job.setJobName("examplefilename");

Upvotes: 4

Related Questions