Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4942

Printing PDF hangs and document is never printed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 2.0.21
    • None
    • None

    Description

      We have an integration that simply prints PDFs. The PDF attached never prints and clogs up the print queue - just ends up spooling for very long periods of time. Code in question that is in use with the latest version of PDFBox:

          PrintService service = getPrintService(printerName);
          DocPrintJob printJob = service.createPrintJob();    PrintRequestAttributeSet attrSet = new HashPrintRequestAttributeSet();
          attrSet.add(new JobName(fileName, null));
          attrSet.add(new Copies(1));    
          try (PDDocument pdf = PDDocument.load(file)) {
            PDFPageable pageable = new PDFPageable(pdf);
            Doc doc = new SimpleDoc(pageable, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
            printJob.print(doc, attrSet);      return new PdfPrintResult(pdf.getNumberOfPages());
          } catch (IOException | PrintException e) {
            throw new ControlledPrintException("Unable to print file " + fileName + ".", e);
          } 
      

      This occurs trying to print to a physical printer as well as to a PDF Printer, e.g., PDFCreator. I am able to open the PDF in the PDFDebugger and view it, but cannot determine what is causing the issue.

      Attachments

        1. problem.pdf
          535 kB
          Jon Ominsky

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jominsky Jon Ominsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: