Hallo,
ich möchte gerne 2 Kopieen eines Ausdruckes haben. Irgendwie klappt es nicht. Hier mal der Code:
pjob.setCopies(2); sollte doch eigentlich für die Anzahl der zu druckenden Elemente stehen, wenn ich das richtig verstanden hab...
Es wird aber nur ein Exemplar gedruckt - Kann mir da jemand helfen?
Danke Oli
ich möchte gerne 2 Kopieen eines Ausdruckes haben. Irgendwie klappt es nicht. Hier mal der Code:
Java:
private void getPrinter() throws PrinterException {
pjob = PrinterJob.getPrinterJob();
Paper a4Paper = new Paper();
PageFormat pf = new PageFormat();
double paperWidth = 8.26;
double paperHeight = 11.69;
double leftMargin = 0.30;
double rightMargin = 0.30;
double topMargin = 0.30;
double bottomMargin = 0.30;
a4Paper.setSize(paperWidth * 72.0, paperHeight * 72.0);
a4Paper.setImageableArea(leftMargin * 72.0, topMargin * 72.0, (paperWidth - leftMargin - rightMargin) * 72.0,
(paperHeight - topMargin - bottomMargin) * 72.0);
pf.setPaper(a4Paper);
Book book = new Book();
ArrayList<Produkt> temp = new ArrayList<Produkt>();
for (int i = 0; i < inhalt.size(); i++) {
if (i != 0 && i != inhalt.size() - 1) {
if (i % 40 != 0) {
temp.add(inhalt.get(i));
}
else {
temp.add(inhalt.get(i));
book.append(new TextPrintable(temp), pf);
temp = new ArrayList<Produkt>();
}
}
else if (i == 0) {
temp.add(inhalt.get(i));
if (inhalt.size() == 1) {
book.append(new TextPrintable(temp), pf);
}
}
else if (i == inhalt.size() - 1) {
temp.add(inhalt.get(i));
book.append(new TextPrintable(temp), pf);
temp = new ArrayList<Produkt>();
}
}
pjob.setPageable(book);
try {
pjob.setCopies(2);
pjob.print();
}
catch (Exception PrintException) {
PrintException.printStackTrace();
}
}
pjob.setCopies(2); sollte doch eigentlich für die Anzahl der zu druckenden Elemente stehen, wenn ich das richtig verstanden hab...
Es wird aber nur ein Exemplar gedruckt - Kann mir da jemand helfen?
Danke Oli