pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: PDF Printing: multiple copies
Date Fri, 08 May 2015 21:40:35 GMT
This has been fixed in 2.0:

https://issues.apache.org/jira/browse/PDFBOX-2094 <https://issues.apache.org/jira/browse/PDFBOX-2094>

— John

> On 7 May 2015, at 16:04, Gregor Kovač <kovica@gmail.com> wrote:
> 
> Hi!
> 
> I'm using PDFBox 1.8.9 and using this method to print a PDF file:
> 
> private static void printWithPDFBox(File pdfFile, int copies) {
>    PDDocument document = null;
> 
>    try {
>        document = PDDocument.load(pdfFile);
> 
>        PrintService printService =
> PrintServiceLookup.lookupDefaultPrintService();
>        PrinterJob printJob = PrinterJob.getPrinterJob();
>        printJob.setJobName(pdfFile.getName());
>        printJob.setPrintService(printService);
>        printJob.setCopies(copies);
> 
>        HashPrintRequestAttributeSet printRequestAttributeSet = new
> HashPrintRequestAttributeSet();
>        printRequestAttributeSet.add(new Copies(copies));
>        printRequestAttributeSet.add(SheetCollate.COLLATED);
>        printJob.setPageable(new PDPageable(document, printJob));
>        printJob.print(printRequestAttributeSet);
>    } catch (Exception e) {
>        e.printStackTrace();
>    } finally {
>        if (document != null) {
>            try {
>                document.close();
>            } catch (IOException e) {
>                e.printStackTrace();
>            }
>        }
>    }
> }
> 
> 
> I have a test file with one page and when I call this method with copies
> greater than 1 I only get one page printed out.
> 
> Am I doing something wrong?
> 
> Best regards,
>    Kovi
> 
> -- 
> -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
> |  In A World Without Fences Who Needs Gates?  |
> |              Experience Linux.               |
> -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message