-
June 20th, 2016, 04:33 AM
#1
set paper size in java printing
Hello,
I'm working on a swing/awt application that generates code128 type barcodes on the specific criterion(business requirement). Now application is functional upto barcode creation but its unable to print that barcode on printer properly. I'm using TSC TTP244 Pro label printer.
Label size is 2.25''x1.25''. Printer prints barcode on label by skipping 4 labels.
Can any body figure out the problem and tell a solution how can I set printing without skipping any label??
Here is my code I'm using for printing.
PrinterJob pj = PrinterJob.getPrinterJob();
if (pj.printDialog()) {
// PageFormat pf = pj.defaultPage();
PageFormat pf = pj.defaultPage();
Paper paper = pf.getPaper();
double width =16.0* 72;
double height = 10 * 72;
double margin = 36 * 72;
paper.setSize(width, height);
paper.setImageableArea(
margin,
margin,
width - (margin * 2),
height - (margin * 2));
pf.setPaper(paper);
try {
pj.setPrintable(new fbc_Main(), pf);
pj.print();
//initialize();
} catch (PrinterException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|