[ 
https://issues.apache.org/jira/browse/PDFBOX-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14021551#comment-14021551
 ] 

You Liang edited comment on PDFBOX-2119 at 6/9/14 3:52 AM:
-----------------------------------------------------------

[~tilman] Below is a snippet of my code, i got the PrinterJob through the 
PrinterJob.getPrinterJob(), afterward i set the printService to the printerJob. 
And then i pass in this printJob through the silentPrint method of the 
PDFPrinter instance.


                         PrinterJob pj = PrinterJob.getPrinterJob();
                        PrintService pservices[] = 
PrintServiceLookup.lookupPrintServices(flavor, aset);
                         PDDocument doc = 
PDDocument.load(PathUtility.getInstance().getFileByPath("out/ResultFO2PDF.pdf"));
                        //For eg, printService[2] is the printService i want
                        pj.setPrintService(printService[2]);                    
                            
                        Settings set = 
SettingsUtility.getInstance().getSettings();
                        Orientation orientation = Orientation.AUTO;             
    
                        PDFPrinter printers;
                        printers = new PDFPrinter(doc, Scaling.ACTUAL_SIZE, 
orientation);                       
                        printers.silentPrint(pj); 
                        doc.close();









was (Author: yl):
[~tilman] Below is a snippet of my code, i got the PrinterJob through the 
PrinterJob.getPrinterJob(), afterward i set the printService to the printerJob. 
And then i pass in this printJob through the silentPrint method of the 
PDFPrinter instance.
                         PrinterJob pj = PrinterJob.getPrinterJob();
                        PrintService pservices[] = 
PrintServiceLookup.lookupPrintServices(flavor, aset);
                         PDDocument doc = 
PDDocument.load(PathUtility.getInstance().getFileByPath("out/ResultFO2PDF.pdf"));
                        //For eg, printService[2] is the printService i want
                        pj.setPrintService(printService[2]);                    
                            
                        Settings set = 
SettingsUtility.getInstance().getSettings();
                        Orientation orientation = Orientation.AUTO;             
    
                        PDFPrinter printers;
                        printers = new PDFPrinter(doc, Scaling.ACTUAL_SIZE, 
orientation);                       
                        printers.silentPrint(pj); 
                        doc.close();








> Possible printing bug for V2.00
> -------------------------------
>
>                 Key: PDFBOX-2119
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2119
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>         Environment: Window 7 Professional SP1, JRE 8.
>            Reporter: You Liang
>            Assignee: Andreas Lehmkühler
>              Labels: pdfbox, printer, printing
>             Fix For: 1.8.6, 2.0.0
>
>
> Printing seems to be using the window default printer paper size instead of 
> selected printService papersize.
> Etc my default Printer is an A4 Printer, and the printer that i had choosen 
> to print is a receipt printer.
> When i print to the receipt printer, it will print out a blown up version of 
> the original pdf, and when i change my default printer to the receipt 
> printer.. everything work fine.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to