Horje
java print pdf to printer Code Example
java print pdf to printer
import com.spire.pdf.*;
import java.awt.print.*;

public class Print {
    public static void main(String[] args) {
        //load the sample document
        PdfDocument pdf = new PdfDocument();
        pdf.loadFromFile("Sample.pdf");

        PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
        PageFormat loPageFormat  = loPrinterJob.defaultPage();
        Paper loPaper = loPageFormat.getPaper();

        //remove the default printing margins
        loPaper.setImageableArea(0,0,loPageFormat.getWidth(),loPageFormat.getHeight());

        //set the number of copies
        loPrinterJob.setCopies(2);

        loPageFormat.setPaper(loPaper);
        loPrinterJob.setPrintable(pdf,loPageFormat);
        try {
            loPrinterJob.print();
        } catch (PrinterException e) {
            e.printStackTrace();
        }
    }
}
Source: dev.to




Java

Related
what are variables in java Code Example what are variables in java Code Example
java suppress warnings rawtypes Code Example java suppress warnings rawtypes Code Example
imageview.setbackground Code Example imageview.setbackground Code Example
java hashmap time complexity Code Example java hashmap time complexity Code Example
como ordenar un arraylist alfabeticamente en java Code Example como ordenar un arraylist alfabeticamente en java Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8